Passing Parameters in buttonclick event in gridview
-
Hi.. I want to pass arguments in buttonclick event in gridivew from aspx page... ]]>'/> this image button is in gridview's ItemTemplate And i have a function like this in code behind.. protected void addtocrt_Click(string str) { Response.Write(str); } But it gives me error... 1) The best overloaded method match for 'Right.addtocrt_Click(string)' has some invalid arguments 2) cannot convert from 'object' to 'string' How to solve this.. Plz give me some solution..
-
Hi.. I want to pass arguments in buttonclick event in gridivew from aspx page... ]]>'/> this image button is in gridview's ItemTemplate And i have a function like this in code behind.. protected void addtocrt_Click(string str) { Response.Write(str); } But it gives me error... 1) The best overloaded method match for 'Right.addtocrt_Click(string)' has some invalid arguments 2) cannot convert from 'object' to 'string' How to solve this.. Plz give me some solution..
sorry i may be wrong ..."TYPE CASTING"
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
-
Hi.. I want to pass arguments in buttonclick event in gridivew from aspx page... ]]>'/> this image button is in gridview's ItemTemplate And i have a function like this in code behind.. protected void addtocrt_Click(string str) { Response.Write(str); } But it gives me error... 1) The best overloaded method match for 'Right.addtocrt_Click(string)' has some invalid arguments 2) cannot convert from 'object' to 'string' How to solve this.. Plz give me some solution..
Hi Test this: addtocrt_Click(Eval("Prod_ID").ToString()) You can pass the parameters in this way too: CommandArgument='<%# Eval("Prod_ID") %>' onclick="addtocrt_Click"> protected void addtocrt_Click(object sender, EventArgs e) { try { ImageButton imgbtn = sender as ImageButton; Response.Write(imgbtn.CommandArgument); } catch (Exception ex) { throw; } }
-
Hi Test this: addtocrt_Click(Eval("Prod_ID").ToString()) You can pass the parameters in this way too: CommandArgument='<%# Eval("Prod_ID") %>' onclick="addtocrt_Click"> protected void addtocrt_Click(object sender, EventArgs e) { try { ImageButton imgbtn = sender as ImageButton; Response.Write(imgbtn.CommandArgument); } catch (Exception ex) { throw; } }