Re: gridview help
- From: <param@xxxxxxxxxxxxxxxx>
- Date: Sat, 9 Dec 2006 13:30:07 -0600
Thanks Suresh. that worked.
"Suresh" <Suresh@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:15FC4387-239A-4C38-B565-CEE869C6424F@xxxxxxxxxxxxxxxx
I believe using the CommandArgument to determine the row index only works
when you use the command field in a gridview.
Not sure if row index is what you are after in the CommandArgument??
If it is try the following:
(FYI you can bind any data item value to the commandargument property as
well)
asp:LinkButton ID="btnedit" runat="server" Text='<%#Eval("feeid") %>'
CommandName="EditSelect" CommandArgument="<%# Container.DataItemIndex %>"
/>
HTH,
Suresh.
"param@xxxxxxxxxxxxxxxx" wrote:
Hi all,
I am trying to have a linkbutton control with the commandname property
set.
However, when I invoke it, the CommandArgument property ends up coming to
be
blank. However, if I click on the buttonfield control i get back the
rowindex in CommandArgument. Why is that? How do I get my custom
linkbutton
to work?
public void GridView_Command(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "EditSelect":
Response.Write(e.CommandArgument);
Response.End();
GridView_Edit(Convert.ToInt32(e.CommandArgument));
break;
}
}
<asp:ButtonField ButtonType="Link" CommandName="EditSelect"
HeaderText="ID"
Text="Edit" />
<asp:TemplateField HeaderText="ID" HeaderStyle-HorizontalAlign="left"
ItemStyle-HorizontalAlign="left">
<ItemTemplate>
<asp:LinkButton ID="btnedit" runat="server" Text='<%#Eval("feeid") %>'
CommandName="EditSelect" />
</ItemTemplate>
</asp:TemplateField>
TIA!
.
- Follow-Ups:
- Re: gridview help
- From: Steven Cheng[MSFT]
- Re: gridview help
- References:
- gridview help
- From: param
- RE: gridview help
- From: Suresh
- gridview help
- Prev by Date: Re: AJAX Update Panel w I.E.7 Problem
- Next by Date: probls with file upload script... pls help
- Previous by thread: RE: gridview help
- Next by thread: Re: gridview help
- Index(es):