944,175 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2295
  • VB.NET RSS
Sep 24th, 2007
0

Problem with datakey in datagrid while paging

Expand Post »
I have a forum where the threads are showing in a datagrid with paging. The paging works fine and show the right result on the next pages.
My problem is in the column which contains a link to the page where the client can read the thread. The link includes the datakey, but the datakey is showing the keys from the first page.

This is the column:
VB.NET Syntax (Toggle Plain Text)
  1. <asp:Templatecolumn ItemStyle-Width="356" ItemStyle-CssClass="bg_forumTema" >
  2. <itemtemplate>
  3. <asp:linkbutton ID="lbTema" runat="server" CssClass="formal_blue_bold" CommandName="Select"
  4. Text='<%#Container.DataItem("tema")%>' />
  5. </itemtemplate>
  6. </asp:templatecolumn>

The datagrid contains this line:
VB.NET Syntax (Toggle Plain Text)
  1. OnSelectedIndexChanged="vis_indlaeg"

Here is the sub where the site is redirected to the wrong post:
VB.NET Syntax (Toggle Plain Text)
  1. Sub vis_indlaeg(obj as object, e as EventArgs)
  2. response.Redirect("forum_vis_indlaeg.aspx?id=" & Datagrid1.DataKeys(Datagrid1.SelectedIndex))
  3. end sub

Viewstate is disabled
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
Danish woman is offline Offline
2 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: OpenFileDialog variation help
Next Thread in VB.NET Forum Timeline: DataGridView populate





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC