B
Bob H
Hi,
I'm new to ASP.Net and am having problems with clicking on a grid item and
being forwarded to another page. Can anyone help out please?
In my grid I've a template column to show a link comprised of several
columns of data (only 1 shown here). I've tried a couple of ways: First I've
tried using the OnCommand of the LinkButton and then I tried using the
OnItemCommand of the Datagrid to point to my ViewDetails sub in the code
behind file
<asp:datagrid...>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton OnCommand="ViewDetails" Runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Name")%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Sub ViewDetails(ByVal sender As System.Object, ByVal e As CommandEventArgs)
Response.Redirect("viewdetails.aspx", False)
End Sub
Once the user clicks the link, I thought that the Viewdetails sub gets
called and they get forwarded to the viewdetails.aspx. This code only seems
to postback to the same page ie the ViewDetails sub doesn't seem to get
called (Once I've got this page working, the idea was to get the ID of the
row the user clicked on and post it with the form to the viewdetails.aspx)
Any clues/pointers please?
Cheers
Bob
I'm new to ASP.Net and am having problems with clicking on a grid item and
being forwarded to another page. Can anyone help out please?
In my grid I've a template column to show a link comprised of several
columns of data (only 1 shown here). I've tried a couple of ways: First I've
tried using the OnCommand of the LinkButton and then I tried using the
OnItemCommand of the Datagrid to point to my ViewDetails sub in the code
behind file
<asp:datagrid...>
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton OnCommand="ViewDetails" Runat="server" Text='<%#
DataBinder.Eval(Container, "DataItem.Name")%>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
Sub ViewDetails(ByVal sender As System.Object, ByVal e As CommandEventArgs)
Response.Redirect("viewdetails.aspx", False)
End Sub
Once the user clicks the link, I thought that the Viewdetails sub gets
called and they get forwarded to the viewdetails.aspx. This code only seems
to postback to the same page ie the ViewDetails sub doesn't seem to get
called (Once I've got this page working, the idea was to get the ID of the
row the user clicked on and post it with the form to the viewdetails.aspx)
Any clues/pointers please?
Cheers
Bob