Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jan 19, 2013 08:03 AM by priyankmtr
Member
570 Points
441 Posts
Jan 17, 2013 11:10 AM|LINK
gridview how to use different row color
Jan 17, 2013 11:12 AM|LINK
different row text based on colour change
Participant
960 Points
459 Posts
Jan 17, 2013 11:37 AM|LINK
Hi if u want to alternative row should have different color use this
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None"> <AlternatingRowStyle BackColor="White" />
or if u want color change of row on mouseover u can try below code in row databound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); e.Row.BackColor = System.Drawing.Color.FromName("white"); } }
76 Points
39 Posts
Jan 17, 2013 12:04 PM|LINK
Use css class for change color in RowStyle and AlternatingRowStyle in GridView on .aspx page.
<asp:gridview ID="Gridview2" runat="server" > <RowStyle CssClass="class1" /> <AlternatingRowStyle CssClass="class2" /> <Columns> </Columns> </asp:gridview>
Contributor
2626 Points
526 Posts
Jan 17, 2013 12:31 PM|LINK
aspx: <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" > ... </asp:GridView> code: using System.Drawing; protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { // searching through the rows if (e.Row.RowType == DataControlRowType.DataRow) { bool isnew = (bool)DataBinder.Eval(e.Row.DataItem, "IsNew"); if ( isnew ) e.Row.BackColor = Color.FromName("#FAF7DA"); // is a "new" row } }
All-Star
36048 Points
7358 Posts
Jan 17, 2013 12:36 PM|LINK
your question too wide, difficult to interpret what you want.
Jan 18, 2013 05:42 AM|LINK
gridview row header name based on row colour change.
Jan 18, 2013 06:00 AM|LINK
still not sure what exactly you want ? explain it will example.
Jan 18, 2013 06:29 AM|LINK
vickyasp.net gridview row header name based on row colour change.
There is no color changed event, you need to descript what you want clearly.
Jan 18, 2013 06:35 AM|LINK
iam using timetable gridview
day hour1 hour2
sun -- ---
mon
i want sunday row different colour based on the text value
vickyasp.net
Member
570 Points
441 Posts
gridview how to use different row color
Jan 17, 2013 11:10 AM|LINK
gridview how to use different row color
Vignesh
vickyasp.net
Member
570 Points
441 Posts
Re: gridview how to use different row color
Jan 17, 2013 11:12 AM|LINK
different row text based on colour change
Vignesh
narasappa
Participant
960 Points
459 Posts
Re: gridview how to use different row color
Jan 17, 2013 11:37 AM|LINK
Hi if u want to alternative row should have different color use this
<asp:GridView ID="GridView1" runat="server" CellPadding="4"
ForeColor="#333333" GridLines="None">
<AlternatingRowStyle BackColor="White" />
or if u want color change of row on mouseover u can try below code in row databound
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("onmouseover", "this.style.backgroundColor='orange'"); e.Row.Attributes.Add("onmouseout", "this.style.backgroundColor='white'"); e.Row.BackColor = System.Drawing.Color.FromName("white"); } }ravi.jadiyannavar@gmail.com
Pls Mark This Post As Answer If it Helps U..
Thanku
Jatin09
Member
76 Points
39 Posts
Re: gridview how to use different row color
Jan 17, 2013 12:04 PM|LINK
Use css class for change color in RowStyle and AlternatingRowStyle in GridView on .aspx page.
<asp:gridview ID="Gridview2" runat="server" >
<RowStyle CssClass="class1" />
<AlternatingRowStyle CssClass="class2" />
<Columns>
</Columns>
</asp:gridview>
priyankmtr
Contributor
2626 Points
526 Posts
Re: gridview how to use different row color
Jan 17, 2013 12:31 PM|LINK
aspx: <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" > ... </asp:GridView> code: using System.Drawing; protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { // searching through the rows if (e.Row.RowType == DataControlRowType.DataRow) { bool isnew = (bool)DataBinder.Eval(e.Row.DataItem, "IsNew"); if ( isnew ) e.Row.BackColor = Color.FromName("#FAF7DA"); // is a "new" row } }(Mark as Answer If you find helpful)
oned_gk
All-Star
36048 Points
7358 Posts
Re: gridview how to use different row color
Jan 17, 2013 12:36 PM|LINK
your question too wide, difficult to interpret what you want.
Suwandi - Non Graduate Programmer
vickyasp.net
Member
570 Points
441 Posts
Re: gridview how to use different row color
Jan 18, 2013 05:42 AM|LINK
gridview row header name based on row colour change.
Vignesh
priyankmtr
Contributor
2626 Points
526 Posts
Re: gridview how to use different row color
Jan 18, 2013 06:00 AM|LINK
still not sure what exactly you want ? explain it will example.
(Mark as Answer If you find helpful)
oned_gk
All-Star
36048 Points
7358 Posts
Re: gridview how to use different row color
Jan 18, 2013 06:29 AM|LINK
There is no color changed event, you need to descript what you want clearly.
Suwandi - Non Graduate Programmer
vickyasp.net
Member
570 Points
441 Posts
Re: gridview how to use different row color
Jan 18, 2013 06:35 AM|LINK
iam using timetable gridview
day hour1 hour2
sun -- ---
mon
i want sunday row different colour based on the text value
Vignesh