Problem with datakey in datagrid while paging

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2007
Posts: 2
Reputation: Danish woman is an unknown quantity at this point 
Solved Threads: 0
Danish woman Danish woman is offline Offline
Newbie Poster

Problem with datakey in datagrid while paging

 
0
  #1
Sep 24th, 2007
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:
  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:
  1. OnSelectedIndexChanged="vis_indlaeg"

Here is the sub where the site is redirected to the wrong post:
  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
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:




Views: 1827 | Replies: 0
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC