Click here to Skip to main content
15,888,984 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: set inputfield value using java in ASP.net Pin
happysoul29-Aug-13 3:34
happysoul29-Aug-13 3:34 
QuestionAjax Form URL from List<ViewModel> Pin
eddieangel28-Aug-13 7:16
eddieangel28-Aug-13 7:16 
QuestionDesign Ideas - List Of Custom controls. Pin
Forbiddenx28-Aug-13 5:57
Forbiddenx28-Aug-13 5:57 
GeneralRe: Design Ideas - List Of Custom controls. Pin
AmitGajjar2-Sep-13 21:05
professionalAmitGajjar2-Sep-13 21:05 
Questionbasic questions about viewstate Pin
ThetaClear26-Aug-13 22:16
ThetaClear26-Aug-13 22:16 
AnswerRe: basic questions about viewstate Pin
Keith Barrow28-Aug-13 6:21
professionalKeith Barrow28-Aug-13 6:21 
GeneralRe: basic questions about viewstate Pin
ThetaClear28-Aug-13 7:02
ThetaClear28-Aug-13 7:02 
QuestionHow to insert Header Rows into Gridview with custom method? Pin
arcadeRob26-Aug-13 6:57
arcadeRob26-Aug-13 6:57 
I have a method that I call on page load that iterates through the rows in a gridview. What I would like to happen is for a header row to be inserted when the 'SectionID' of the row changes (it is a data key.)

There will be 6 additional header rows inserted and my code is doing just that except it is inserting all of the additional rows at the top (under the original header and before the first data row.) I want it to insert when the 'SectionID' changes.

Here is my method:


C#
protected void addHeaders() {
    foreach (GridViewRow row in GridView1.Rows) {
        if (row.RowType == DataControlRowType.DataRow) {
            tmpSectionID = GridView1.DataKeys[row.RowIndex].Values["SectionID"].ToString();

            if (sectionID != tmpSectionID) {
                sectionID = tmpSectionID;
                GridView gvw = (GridView)GridView1;
                DataRowView drv = (DataRowView)row.DataItem;

                GridViewRow HeaderRow = new GridViewRow(-1, -1, DataControlRowType.Header, DataControlRowState.Normal);
                Table tbl = row.Parent as Table;
                Table myTable = (Table)GridView1.Controls[0];
                TableCell HeaderCell = new TableCell();

                HeaderCell.ColumnSpan = this.GridView1.Columns.Count;
                HeaderCell.Style.Add("font-weight", "bold");
                HeaderCell.Style.Add("background-color", "#22539B");
                HeaderCell.Style.Add("color", "white");
                HtmlGenericControl HeaderSpan = new HtmlGenericControl("span");
                HeaderCell.ToolTip = "Tooltip Here";
                HeaderSpan.InnerHtml = "Inserted Row";
                HeaderCell.Controls.Add(HeaderSpan);
                HeaderRow.Cells.Add(HeaderCell);
                myTable.Rows.AddAt(1, HeaderRow);
            }
        }
    }
}

QuestionMenu Navigation Pin
Codes DeCodes26-Aug-13 0:37
Codes DeCodes26-Aug-13 0:37 
AnswerRe: Menu Navigation Pin
Paramu197326-Aug-13 4:10
Paramu197326-Aug-13 4:10 
GeneralRe: Menu Navigation Pin
Codes DeCodes26-Aug-13 18:48
Codes DeCodes26-Aug-13 18:48 
AnswerRe: Menu Navigation Pin
Priyanka Bhagwat28-Aug-13 21:33
professionalPriyanka Bhagwat28-Aug-13 21:33 
GeneralRe: Menu Navigation Pin
Codes DeCodes30-Aug-13 0:45
Codes DeCodes30-Aug-13 0:45 
QuestionUpdatePanel Image -Update Pin
Paramu197325-Aug-13 21:53
Paramu197325-Aug-13 21:53 
AnswerRe: UpdatePanel Image -Update Pin
jkirkerx26-Aug-13 6:52
professionaljkirkerx26-Aug-13 6:52 
QuestionDotnetnuke bootstrap Pin
sarang_k25-Aug-13 2:18
sarang_k25-Aug-13 2:18 
Questionhow to run java command on web server Pin
ianoseb24-Aug-13 23:12
ianoseb24-Aug-13 23:12 
AnswerRe: how to run java command on web server Pin
Bernhard Hiller25-Aug-13 21:24
Bernhard Hiller25-Aug-13 21:24 
QuestionViewing password Pin
larsp77723-Aug-13 3:52
larsp77723-Aug-13 3:52 
AnswerRe: Viewing password Pin
Forbiddenx23-Aug-13 4:37
Forbiddenx23-Aug-13 4:37 
AnswerRe: Viewing password Pin
Boipelo24-Aug-13 10:43
Boipelo24-Aug-13 10:43 
GeneralRe: Viewing password Pin
larsp77724-Aug-13 22:30
larsp77724-Aug-13 22:30 
GeneralRe: Viewing password Pin
Boipelo25-Aug-13 10:11
Boipelo25-Aug-13 10:11 
GeneralRe: Viewing password Pin
Deflinek27-Aug-13 4:24
Deflinek27-Aug-13 4:24 
GeneralRe: Viewing password Pin
larsp77727-Aug-13 21:26
larsp77727-Aug-13 21:26 

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.