B
Brett Wesoloski
I am having problems getting the index of an image click event in a
datagrid. Every time I look at the index it is -1.
What I am trying to do is get the index of the row in which the imagebutton
was clicked. So that I can then go and look into a hidden field as to what
the value will be that I need to use.
I am using a template column to create the imagebutton.
<asp:TemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton ID="btnF" Runat="server"
ImageUrl="/common/images/F.gif"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
Here is my C# code
public void btnF_Click(object sender, ImageClickEventArgs e)
{
dgInvestmentInfo.SelectedIndex always returns -1 no matter what row I click
on...
}
Well not sure what I am doing wrong but I can't seem to figure out how to
get the row of the datagrid that was clicked.
I am binding a datatable to the datagrid.
Well hopefully someone can help me with this.
Thanks,
Brett
datagrid. Every time I look at the index it is -1.
What I am trying to do is get the index of the row in which the imagebutton
was clicked. So that I can then go and look into a hidden field as to what
the value will be that I need to use.
I am using a template column to create the imagebutton.
<asp:TemplateColumn HeaderText="">
<ItemTemplate>
<asp:ImageButton ID="btnF" Runat="server"
ImageUrl="/common/images/F.gif"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateColumn>
Here is my C# code
public void btnF_Click(object sender, ImageClickEventArgs e)
{
dgInvestmentInfo.SelectedIndex always returns -1 no matter what row I click
on...
}
Well not sure what I am doing wrong but I can't seem to figure out how to
get the row of the datagrid that was clicked.
I am binding a datatable to the datagrid.
Well hopefully someone can help me with this.
Thanks,
Brett