Click here to Skip to main content
15,920,217 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionDataGrid Postback Problem Pin
Expert Coming31-May-07 11:11
Expert Coming31-May-07 11:11 
QuestionDataGrid and DataBinding question Pin
(Steven Hicks)n+131-May-07 10:56
(Steven Hicks)n+131-May-07 10:56 
AnswerRe: DataGrid and DataBinding question Pin
Fred_Smith31-May-07 12:01
Fred_Smith31-May-07 12:01 
GeneralRe: DataGrid and DataBinding question Pin
(Steven Hicks)n+131-May-07 12:42
(Steven Hicks)n+131-May-07 12:42 
GeneralRe: DataGrid and DataBinding question Pin
Fred_Smith31-May-07 13:56
Fred_Smith31-May-07 13:56 
QuestionDataGridView Row Colors Pin
Kschuler31-May-07 9:56
Kschuler31-May-07 9:56 
AnswerRe: DataGridView Row Colors Pin
Sherin Iranimose31-May-07 17:54
Sherin Iranimose31-May-07 17:54 
GeneralRe: DataGridView Row Colors Pin
Kschuler1-Jun-07 3:04
Kschuler1-Jun-07 3:04 
I have continued to work on this problem and have gotten a little further, but I am still having trouble. First of all, to be clear, I'm working with a DataGridView control. A DataGridViewRow does not have a BackColor property to set. What I'm doing now is looping through each row in the DataGridView and then each cell in that row and setting the style of that cell based on my own criteria. The problem is, that when I call this code in the form load event, it doesn't appear to work. But if I call it from another event that fires after the page has loaded, it DOES work. Does anyone know why this is, or what I can do to work around it? My goal here is that I have a grid that holds records AND related subrecords. I want to do an alternating highlight, but I want to include the subrecords in the highlight, so the highlight is not going to necessarily be every other line. Here is the code I am using:
Dim boolNormal As Boolean = True
Dim sNormal As New DataGridViewCellStyle
sNormal.BackColor = Color.White
sNormal.ForeColor = Color.Black
sNormal.SelectionBackColor = Color.White
sNormal.SelectionForeColor = Color.Black

Dim sContrast As New DataGridViewCellStyle
sContrast.BackColor = gblclrContrastBack
sContrast.ForeColor = gblclrContrastFont
sContrast.SelectionBackColor = gblclrContrastBack
sContrast.SelectionForeColor = gblclrContrastFont

For Each dgvr As DataGridViewRow In dgvFields.Rows
    If dgvr.Cells("PDSeq").Value.ToString.Trim.Length = 0 Then
        'Main Record
        If boolNormal Then
            For Each dgvc As DataGridViewCell In dgvr.Cells
                dgvc.Style = sNormal
            Next
        Else
            For Each dgvc As DataGridViewCell In dgvr.Cells
                dgvc.Style = sContrast
            Next
        End If
        boolNormal = Not boolNormal
    Else
        'Sub Record
        If boolNormal Then
            For Each dgvc As DataGridViewCell In dgvr.Cells
                dgvc.Style = sContrast
            Next
        Else
            For Each dgvc As DataGridViewCell In dgvr.Cells
                dgvc.Style = sNormal
            Next
        End If
    End If
Next

GeneralRe: DataGridView Row Colors Pin
Kschuler1-Jun-07 3:42
Kschuler1-Jun-07 3:42 
GeneralRe: DataGridView Row Colors Pin
Sherin Iranimose1-Jun-07 4:58
Sherin Iranimose1-Jun-07 4:58 
QuestionAjax.NET vs Atlas Pin
hamidreza_buddy31-May-07 9:30
hamidreza_buddy31-May-07 9:30 
AnswerRe: Ajax.NET vs Atlas Pin
Christian Graus31-May-07 10:25
protectorChristian Graus31-May-07 10:25 
AnswerRe: Ajax.NET vs Atlas Pin
Joseph Guadagno31-May-07 10:28
Joseph Guadagno31-May-07 10:28 
GeneralRe: Ajax.NET vs Atlas Pin
Christian Graus31-May-07 11:34
protectorChristian Graus31-May-07 11:34 
GeneralRe: Ajax.NET vs Atlas Pin
RichardGrimmer1-Jun-07 4:43
RichardGrimmer1-Jun-07 4:43 
AnswerRe: Ajax.NET vs Atlas Pin
eggie531-May-07 19:03
eggie531-May-07 19:03 
QuestionSpreadsheet Control Pin
Revant Jain31-May-07 9:29
Revant Jain31-May-07 9:29 
AnswerRe: Spreadsheet Control Pin
Christian Graus31-May-07 10:26
protectorChristian Graus31-May-07 10:26 
GeneralRe: Spreadsheet Control Pin
Revant Jain31-May-07 10:33
Revant Jain31-May-07 10:33 
GeneralRe: Spreadsheet Control Pin
Christian Graus31-May-07 14:00
protectorChristian Graus31-May-07 14:00 
Questionincompatibility between IE6 and IE7 / Mozilla Firefox Pin
DKalepu31-May-07 6:28
DKalepu31-May-07 6:28 
AnswerRe: incompatibility between IE6 and IE7 / Mozilla Firefox Pin
DKalepu31-May-07 18:31
DKalepu31-May-07 18:31 
QuestionClientID's ???? Pin
steffw31-May-07 5:27
steffw31-May-07 5:27 
AnswerRe: ClientID's ???? Pin
eggsovereasy31-May-07 5:49
eggsovereasy31-May-07 5:49 
QuestionSend email to multiple users with matching ID's (Asp.Net2 C#) Pin
AdamskiR31-May-07 4:38
AdamskiR31-May-07 4:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.