Showing posts with label asp.net c# datagrid. Show all posts
Showing posts with label asp.net c# datagrid. Show all posts
Tuesday, November 24, 2009
ASP.NET function calling from HTML
<%# formatColor(DataBinder.Eval(Container.DataItem, "status").ToString()) %>
Saturday, August 22, 2009
Radio button in datagrid
Radio buttons will not work by default inside a datagrid. The selection will be individual, because the groupname/id of the control is going to be different for each role automatically. Hence we need to make use of the literal control.
1. Insert literal control instead of the radiobutton control into the datagrid
2. The idea is to find the literal control inside the datagrid
3. Replace it with a radio button control with a fix name.
Something like:
if (e.Row.RowType == DataControlRowType.DataRow)
{
Literal literal = (Literal) e.Row.FindControl("RadioButtonMarkup");
literal.Text = String.Format("<input type='radio' name='couponId' id='coupon{0}' value='{0}' />", e.Row.RowIndex);
}
1. Insert literal control instead of the radiobutton control into the datagrid
2. The idea is to find the literal control inside the datagrid
3. Replace it with a radio button control with a fix name.
Something like:
if (e.Row.RowType == DataControlRowType.DataRow)
{
Literal literal = (Literal) e.Row.FindControl("RadioButtonMarkup");
literal.Text = String.Format("<input type='radio' name='couponId' id='coupon{0}' value='{0}' />", e.Row.RowIndex);
}
Subscribe to:
Posts (Atom)