+ Reply to Thread
Page 4 of 6 FirstFirst ... 2 3 4 5 6 LastLast
Results 31 to 40 of 54

Thread: Create control according to their data type

  1. #31
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    with above problem now i want to save that values in database also.so any direction is appreciated.
    Love is physical attraction and mental destruction

  2. #32
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Here's how I handle the paging:

    First, create a property:
    Code:
    public int CurrentPage { 
        get { 
            if (string.IsNullOrEmpty(ViewState("currentPage"))) { 
                return 1; 
            } 
            else { 
                return (int)ViewState("currentPage"); 
            } 
        } 
        set { ViewState("currentPage") = value; } 
    }
    
    Then, create your PagedDataSource and set the CurrentPageIndex:
    Code:
    { 
        PagedDataSource pgdSource = new PagedDataSource(); 
        
        { 
            pgdSource.DataSource = yourdatasource; 
            pgdSource.AllowPaging = true; 
            pgdSource.PageSize = 20; 
            pgdSource.CurrentPageIndex = (CurrentPage - 1); 
        } 
    }
    
    Then, you change the CurrentPage property on the event you want to change the page. For example, if your paging was displayed in a dropdown list, use the DropDownList.SelectedIndexChanged event to set CurrentPage equal to the selected value.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #33
    Administrator richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich is a splendid one to behold richyrich's Avatar
    Join Date
    Mar 2008
    Location
    Somewhere only we know...
    Posts
    3,207
    Blog Entries
    14
    Real Name
    Rich
    Rep Power
    14

    I believe the paging is sorted J.

    As I understand it, the issue is, if you change a textbox or dropdown on page 1 and then go to page 2, when you go back to page 1, the new details you entered aren't saved. It's these changes guddu needs to keep.

    I would assume the best way would be to update the db when the page changes?

  4. #34
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Then the values and ID's of each control would have to be stored in viewstate as well. Then, when a page is clicked, during that event you would have to check if there is a value for the id in viewstate and then set the value of the control to the value in viewstate. The same concept is used here with CheckBoxes: Maintaining Checkbox State in a Listview
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  5. #35
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    hey can give me link which used c# for this purpose.
    Love is physical attraction and mental destruction

  6. #36
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Quote Originally Posted by guddu View Post
    hey can give me link which used c# for this purpose.
    Just use the converter: Convert VB.NET to C# - A free code conversion tool - developer Fusion - Visual Basic, C# Programming, ASP.NET, .NET Framework and Java Tutorials
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  7. #37
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    huh.during conversion i m getting error for below code
    line 1 col 11: invalid NonModuleDeclaration
    Code:
    Protected Sub AddRowstoIDList()
        ' Loop through all the current items in the Listview
        For Each lvi As ListViewDataItem In ListView1.Items
            ' Find the checkbox in each row
            Dim chkSelect As CheckBox = CType(lvi.FindControl("chkSelect"), CheckBox)
            ' If the checkbox is ticked then add the corresponding ID to our private list
            If (Not (chkSelect) Is Nothing) Then
                ' Get the ID from the datakeynames property
                    Dim ID As Integer = 
                Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value)
                If (chkSelect.Checked AndAlso Not Me.IDs.Contains(ID)) Then
                    ' Add the ID to our list
                    Me.IDs.Add(ID)
                ElseIf (Not chkSelect.Checked AndAlso Me.IDs.Contains(ID)) Then
                    ' Not checked - remove the ID from our list
                    Me.IDs.Remove(ID)
                End If
            End If
        Next
    End Sub
    
    Love is physical attraction and mental destruction

  8. #38
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    I'm not sure why it's not converting, but just take the concept and see what you can come up with.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  9. #39
    Barn Enthusiast guddu is on a distinguished road guddu's Avatar
    Join Date
    Jul 2008
    Location
    Oxford UK
    Posts
    469
    Rep Power
    4

    can u tell me how to convert this line
    Code:
    ' Get the ID from the datakeynames property
                    Dim ID As Integer =   Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value)
    
    for my repeater control???
    Love is physical attraction and mental destruction

  10. #40
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,533
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    Code:
    int ID = Convert.ToInt32(Listview1.DataKeys(lvi.DisplayIndex).Value);
    
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


+ Reply to Thread
Page 4 of 6 FirstFirst ... 2 3 4 5 6 LastLast

Similar Threads

  1. Create/Print Form data
    By Rebelle in forum ASP Development
    Replies: 5
    Last Post: December 10th, 2008, 10:25 AM
  2. Binding data to the RadioButtonList Control
    By Shem in forum .NET Development
    Replies: 2
    Last Post: December 3rd, 2008, 02:42 AM
  3. Replies: 5
    Last Post: June 25th, 2008, 09:07 AM
  4. Data Type Mismatch in Criteria Expression
    By alansidman in forum Microsoft Access
    Replies: 1
    Last Post: April 9th, 2008, 05:33 PM
  5. Type mismatch: HTMLEncode
    By Rebelle in forum ASP Development
    Replies: 20
    Last Post: March 28th, 2008, 10:30 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

SEO by vBSEO