Results 1 to 8 of 8

Thread: datagrid with template column

  1. #1

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Bangalore
    Posts
    47

    datagrid with template column

    Hi,
    I have datagrid in my web form(code behind VB.Net).In that i have template coloumn with textbox.whenever i moved to next page and previous page,the data which entered in textbox not visible.i have written databind in form load. can any body give me solution



    Thanks
    satish

  2. #2
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: datagrid with template column

    Move to next page and previous page, do you mean Paging? If so make sure you are rebinding the DataGrid in PageIndexChanged event...
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  3. #3

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Bangalore
    Posts
    47

    Re: datagrid with template column

    Yes im doing this on pageindex change

    dg.CurrentPageIndex = e.NewPageIndex
    dg.DataBind()

    After writing something on textbox in page one,if go for next and previous the text in textbox not visible.I enable the viewstate also..but same problem.

  4. #4
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: datagrid with template column

    Quote Originally Posted by dgsatish
    Yes im doing this on pageindex change

    dg.CurrentPageIndex = e.NewPageIndex
    dg.DataBind()

    After writing something on textbox in page one,if go for next and previous the text in textbox not visible.I enable the viewstate also..but same problem.
    How/where are you defining DataSource for dg?
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  5. #5

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Bangalore
    Posts
    47

    Re: datagrid with template column

    this is im doing in form load

    Dim ds As New DataSet
    Dim da As New SqlDataAdapter(strsql, objcon)
    da.Fill(ds, "user_verint")
    dg.DataSource = ds.Tables("user_verint").DefaultView
    If (ds.Tables("user_verint").Rows.Count <> 0) Then

    If (Not IsPostBack) Then
    dg.DataBind()
    End If
    Else
    Response.Redirect("NoRecords.aspx")
    End If

  6. #6
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: datagrid with template column

    VB Code:
    1. 'put this on PageLoad
    2. If Not(Page.IsPostBack) then
    3.         BindGrid()
    4. End If
    5.  
    6. 'Put this in dg_PageIndexChanged
    7.    dg.CurrentPageIndex = e.NewPageIndex
    8.    BindGrid()
    9.  
    10.  
    11.  
    12. Private sub BindGrid()
    13.     Dim ds As New DataSet
    14.     Dim da As New SqlDataAdapter(strsql, objcon)
    15.     da.Fill(ds, "user_verint")
    16.    
    17.     dg.DataSource = ds.Tables("user_verint").DefaultView
    18.  
    19.     If (ds.Tables("user_verint").Rows.Count <> 0) Then
    20.        
    21.         dg.DataBind()
    22.     End If
    23.    
    24. End Sub
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

  7. #7

    Thread Starter
    Member
    Join Date
    Jan 2003
    Location
    Bangalore
    Posts
    47

    Re: datagrid with template column

    Post back and page index change i am doing but my problem is

    I have datagrid in my web form(code behind VB.Net).In that i have template coloumn with textbox.I enterd some text in textbox and moved to next records.when i come back pressing previous link,i am not finding the text which was enterd previously.

  8. #8
    Big D Danial's Avatar
    Join Date
    Jul 2000
    Location
    ASP.Net Forum
    Posts
    2,877

    Re: datagrid with template column

    You wont, whenever you navigate to a new page, all values you have entered will be lost unless you store it or save it to the database..
    [VBF RSS Feed]

    There is a great war coming. Are you sure you are on the right side? Atleast I have chosen a side.

    If I have been helpful, Please Rate my Post. Thanks.

    This post was powered by :

Posting Permissions

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



Click Here to Expand Forum to Full Width