GridView is very power fool control in .NET. Whatever the control we want to add we can add very easily.
Here is the simple Example of ad a check box in GridView:-
Just Double Click on image and see only bold text. I am using here ItemTemplate By the Item Style tag we can set style of a control which i am using inside the ItemTemplate . After this i am placing check box control. We can place any control whatever we want . After this i am taking a hidden control which i will use at the time of fetch the value corresponding to selected check box.
Here is the code for accessing the value of check box control:-
foreach (GridViewRow row in GridView1.Rows)
{
if (((CheckBox)(row.Cells[0].FindControl("RowLevelCheckBox"))).Checked)
{
string id = ((HtmlInputHidden)(row.Cells[0].FindControl("RowLevelIdHidden"))).Value.Trim() ;
sendValue(siteiId,adIdStr, "activated");
}
}
By this code snippet i am sending selected check box's id to sendvalue function.
I hope this blog is useful for you.
Jaydeep Vishwakarma.
jaydeepmailv@gamil.com
Saturday, April 19, 2008
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment