mahsa.n
دوشنبه 22 اسفند 1390, 00:03 صبح
سلام
من یه گریدویو دارم میخوام وقتی روی سطری از اون کلیک میشه رنگ پس زمینه سطر مثلا آبی بشه، کد زیر رو گذاشتم ولی اجرا نمیشه لطفا راهنمایی کنید
<asp:GridView ID="grdArticleGroups" runat="server" AutoGenerateColumns="False" DataKeyNames="ArticleGroupId"
DataSourceID="ArticleGroupsSqlDataSource"
ShowHeader="false"
OnRowDataBound="grdArticleGroups_RowDataBound" onselectedindexchanged="grdArticleGroups_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="ArticleGroupId" HeaderText="ArticleGroupId" ReadOnly="True"
SortExpression="ArticleGroupId" Visible="false" />
<asp:BoundField DataField="ArticleGroupTitle" HeaderText="ArticleGroupTitle" SortExpression="ArticleGroupTitle" />
<asp:CommandField ShowSelectButton="True" ItemStyle-CssClass="HiddenColumn" HeaderStyle-CssClass="HiddenColumn"/>
</Columns>
</asp:GridView>
protected void grdArticleGroups_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = grdArticleGroups.SelectedRow;
row.BackColor = System.Drawing.Color.Blue;
}
من یه گریدویو دارم میخوام وقتی روی سطری از اون کلیک میشه رنگ پس زمینه سطر مثلا آبی بشه، کد زیر رو گذاشتم ولی اجرا نمیشه لطفا راهنمایی کنید
<asp:GridView ID="grdArticleGroups" runat="server" AutoGenerateColumns="False" DataKeyNames="ArticleGroupId"
DataSourceID="ArticleGroupsSqlDataSource"
ShowHeader="false"
OnRowDataBound="grdArticleGroups_RowDataBound" onselectedindexchanged="grdArticleGroups_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="ArticleGroupId" HeaderText="ArticleGroupId" ReadOnly="True"
SortExpression="ArticleGroupId" Visible="false" />
<asp:BoundField DataField="ArticleGroupTitle" HeaderText="ArticleGroupTitle" SortExpression="ArticleGroupTitle" />
<asp:CommandField ShowSelectButton="True" ItemStyle-CssClass="HiddenColumn" HeaderStyle-CssClass="HiddenColumn"/>
</Columns>
</asp:GridView>
protected void grdArticleGroups_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = grdArticleGroups.SelectedRow;
row.BackColor = System.Drawing.Color.Blue;
}