i have one grid in that i add one button and i set RowCommand event like this
OnRowCommand="gvProject_RowCommand" and the code for button is
when i click the button on page its not generating the event please any one tell me where i am doing mistake
thanks in advance
Master BillaPosted Oct 12, 2009, 12:47 PM
I think something you are missing,
try with this my code
protected void gridviewSRHeaders_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Update")
{
GridViewRow row = gridviewSRHeaders.Rows[Convert.ToInt32(e.CommandArgument)];
}
}
<asp:GridView ID="gridviewSRHeaders" runat="server" AllowPaging="True" AutoGenerateColumns="False"
OnRowCommand="gridviewSRHeaders_RowCommand">
<asp:ImageButton ID="btnEdit" runat="server" ToolTip="Update" CommandName="Update" CommandArgument="<%# Container.DataItemIndex %>"
/>
GridView>
thank you
Roei BarPosted Oct 12, 2009, 11:33 AM
its probebly something stupid
Kirtan PatelPosted Oct 12, 2009, 11:13 AM
send it in Zip File
[email protected]
mohdazeemuddin ahmedPosted Oct 12, 2009, 11:09 AM
Kirtan PatelPosted Oct 12, 2009, 10:55 AM
Code Behind
----------------------------------------------------------------------------
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "SendRequest")
{
Response.Write("Testing Event ");
}
}
HTML Code
-------------------------------
and Make sure weather the Executing method is also selected in Properties/Event window may be its not selected by some cause .
mohdazeemuddin ahmedPosted Oct 12, 2009, 10:40 AM
{
if (e.CommandName == "SendRequest")
{
int index = Convert.ToInt32(e.CommandArgument);
GridViewRow row = gvProject.Rows[index];
lblMessage.Text = "hello";
lblMessage.Visible = true;
}
}
for testing i am displaying some message if it work i will write my logic but the frame work dos not entering into this method its not executing this method
Kirtan PatelPosted Oct 12, 2009, 10:32 AM