Click here to Skip to main content
15,886,069 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all
I have one grid view in that i have item template called link button by clicking on that link button Ajax popup extender will appear and user Edits the items.. After editing the Row Color should Change to some other color.. Colors should Change Permanently.. How Can i Achieve this

Thanks
Posted

1 solution

The code below populates a gridview control which has all its rows' ForeColor set to Drawing.Color.Blue. The Page_Load routine runs fine as the gridview appears with all the right data in Blue. Upon clicking btnSelect, the debugger starts off in Page_Load, skips over the subroutine because it is a postback, then jumps into the btnSelect_Click code, sets all the gv.Rows ForeColor to Red and exits. The page reappears from debug and the gridview ForeColor is still Blue!! I cannot figure this one out. Anybody out there have any (polite) suggestions? My first experience with the gridview.

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If (Not Page.IsPostBack) Then
cn = Session("Connection")

If (cn.State.ToString = "Closed") Then cn.Open()
cmd = New SqlCommand("SelectAllStores", cn)

cmd.CommandType = Data.CommandType.StoredProcedure

sdr = cmd.ExecuteReader

If (sdr.HasRows) Then

gv.DataSource = sdr

gv.DataBind()

End If

sdr.Close()

cmd.Dispose()

End If

End Sub

 
Protected Sub btnSelect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _

Handles btnSelect.Click

Dim i As Integer
For i = 0 To gv.Rows.Count - 1

gv.Rows(i).ForeColor = Drawing.Color.Red
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900