my source is
<
div
>
asp:GridView
ID
=
"GridView1"
runat
"server"
AutoGenerateColumns
"false"
onrowdatabound
"GridView1_RowDataBound"
onselectedindexchanged
"GridView1_SelectedIndexChanged"
Columns
asp:TemplateField
HeaderText
"Id"
ItemTemplate
asp:Label
"Label4"
Text="<%#bind('id') %>"></
</
"Name"
"Label5"
Text="<%#bind('Name') %>"></
"Status"
"Label6"
Text="<%#bind('Status') %>"></
asp:ButtonField
Text
"Select"
Visible
/>
br
asp:Button
"Button1"
onclick
"Button1_Click"
"Clear"
Width
"168px"
my code
is
protected
void
Button1_Click(
object
sender, EventArgs e)
{
foreach
(GridViewRow row
in
GridView1.Rows)
if
(row.RowIndex == GridView1.SelectedIndex)
row.BackColor = ColorTranslator.FromHtml(
"#A1DCF2"
);
DataTable dt = (DataTable)ViewState[
"DataTable"
];
dt.Rows.Remove(row);
ViewState[
] = dt;
GridView1.DataSource = dt;
GridView1.DataBind();
row.ToolTip =
string
.Empty;
}}}
my error is
Server Error in '/bramandam site' Application.
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: CS1502: The best overloaded method match for 'System.Data.DataRowCollection.Remove(System.Data.DataRow)' has some invalid arguments
Source Error:
Line 78: row.BackColor = ColorTranslator.FromHtml("#A1DCF2");
Line 79: DataTable dt = (DataTable)ViewState["DataTable"];
Line 80: dt.Rows.Remove(row);
Line 81: ViewState["DataTable"] = dt;
Line 82: GridView1.DataSource = dt;
Source File: d:\bramandam site\grd.aspx.cs Line: 80
Show Detailed Compiler Output:
Show Complete Compilation Source:
Version Information: Microsoft .NET Framework Version:2.0.50727.4984; ASP.NET Version:2.0.50727.4971