User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the VB.NET section within the Software Development category of DaniWeb, a massive community of 456,507 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,657 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our VB.NET advertiser: Programming Forums
Views: 1046 | Replies: 0
Reply
Join Date: Aug 2007
Posts: 2
Reputation: Danish woman is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
Danish woman Danish woman is offline Offline
Newbie Poster

Problem with datakey in datagrid while paging

  #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:
      <asp:Templatecolumn ItemStyle-Width="356" ItemStyle-CssClass="bg_forumTema" >
          <itemtemplate>
          <asp:linkbutton ID="lbTema" runat="server" CssClass="formal_blue_bold" CommandName="Select"
             Text='<%#Container.DataItem("tema")%>' />
     </itemtemplate>
    </asp:templatecolumn>

The datagrid contains this line:
    OnSelectedIndexChanged="vis_indlaeg"

Here is the sub where the site is redirected to the wrong post:
Sub vis_indlaeg(obj as object, e as EventArgs)
    response.Redirect("forum_vis_indlaeg.aspx?id=" & Datagrid1.DataKeys(Datagrid1.SelectedIndex))
end sub

Viewstate is disabled
AddThis Social Bookmark Button
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb VB.NET Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the VB.NET Forum

All times are GMT -4. The time now is 3:41 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC