Click here to Skip to main content
15,911,132 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Why Event is not firing for an ASP.NET Button?? Pin
eggsovereasy22-Jun-06 7:48
eggsovereasy22-Jun-06 7:48 
GeneralRe: Why Event is not firing for an ASP.NET Button?? Pin
SIJUTHOMASP22-Jun-06 8:10
professionalSIJUTHOMASP22-Jun-06 8:10 
GeneralRe: Why Event is not firing for an ASP.NET Button?? Pin
mayurmanu@hotmail.com22-Jun-06 20:16
mayurmanu@hotmail.com22-Jun-06 20:16 
AnswerRe: Why Event is not firing for an ASP.NET Button?? Pin
Nagraj Naik22-Jun-06 20:29
Nagraj Naik22-Jun-06 20:29 
QuestionGridView.Columns Pin
eggsovereasy22-Jun-06 5:57
eggsovereasy22-Jun-06 5:57 
AnswerRe: GridView.Columns Pin
Mike Ellison22-Jun-06 7:30
Mike Ellison22-Jun-06 7:30 
GeneralRe: GridView.Columns Pin
eggsovereasy22-Jun-06 7:46
eggsovereasy22-Jun-06 7:46 
GeneralRe: GridView.Columns Pin
Mike Ellison22-Jun-06 8:42
Mike Ellison22-Jun-06 8:42 
Okay - you can probably get the effect you are looking for, but not in the way you're thinking now. Let me try to explain why. When the GridView renders, it is outputting <tr;> and <td> tags, so the widths in this context is managed by the browser. Even if you explictly added a Width attribute to the individual cells of the table row, say in an OnRowDataBound event handler, I'm guessing you won't get the results you are looking for - the browser may still decide to render widths differently in the two tables.

But you might consider adding your topper row to the underlying table in the gridview directly. You could do this with an event handler for the DataBound event of the gridView. Something like this:
void MyDataBound(Object o, EventArgs e)
{
    // add a special heading at the top of the gridview table;
    // assumes gv is the id of the gridview
    
    Table t = gv.Controls[0] as Table
    if (t != null)
    {
        GridViewRow heading = new GridViewRow(0, -1
                      , DataControlRowType.Header
                      , DataControlRowState.Normal
                      );

        // add cell(s) to the heading row                      
        // in this example, I'm just adding one that will span
        // all the columns of the row
        
        TableCell cell = New TableCell();
        cell.Text = "My Spanning Heading";
        cell.ColumnSpan = gv.Rows(0).Cells.Count;
        
        // make it the same heading style as the gridview
        cell.MergeStyle(gv.HeaderStyle);
        
        // add it to the new heading row
        heading.Cells.Add(cell);
        
        // and add the new heading row to the top of the gridview
        t.Rows.AddAt(0, heading);
    }   
}
and your markup for the gridview would assign OnDataBound:
<asp:GridView ID="gv" runat="server"
              OnDataBound="MyDataBound" 
              />

GeneralBrilliant! Pin
eggsovereasy22-Jun-06 9:30
eggsovereasy22-Jun-06 9:30 
GeneralRe: Brilliant! Pin
Mike Ellison22-Jun-06 10:20
Mike Ellison22-Jun-06 10:20 
QuestionAdding DataRow in DataTable Pin
peshawarcoder22-Jun-06 5:08
peshawarcoder22-Jun-06 5:08 
AnswerRe: Adding DataRow in DataTable Pin
Paddy Boyd22-Jun-06 5:52
Paddy Boyd22-Jun-06 5:52 
GeneralRe: Adding DataRow in DataTable Pin
peshawarcoder22-Jun-06 5:57
peshawarcoder22-Jun-06 5:57 
QuestionObjectDatasource Deletemethod w custom Business Object [modified] Pin
patt22-Jun-06 4:37
patt22-Jun-06 4:37 
AnswerRe: ObjectDatasource Deletemethod w custom Business Object Pin
minhpc_bk22-Jun-06 5:30
minhpc_bk22-Jun-06 5:30 
GeneralRe: ObjectDatasource Deletemethod w custom Business Object Pin
patt22-Jun-06 5:48
patt22-Jun-06 5:48 
GeneralRe: ObjectDatasource Deletemethod w custom Business Object Pin
minhpc_bk22-Jun-06 15:01
minhpc_bk22-Jun-06 15:01 
QuestionFree AJAX enabled Controls [modified] Pin
wEb GuRu...22-Jun-06 4:33
wEb GuRu...22-Jun-06 4:33 
AnswerRe: Free AJAX enabled Controls Pin
RichardGrimmer22-Jun-06 4:49
RichardGrimmer22-Jun-06 4:49 
QuestionHow to handle a click of a hyperlink Pin
widget122-Jun-06 4:16
widget122-Jun-06 4:16 
AnswerRe: How to handle a click of a hyperlink Pin
RichardGrimmer22-Jun-06 4:52
RichardGrimmer22-Jun-06 4:52 
GeneralRe: How to handle a click of a hyperlink Pin
widget122-Jun-06 5:57
widget122-Jun-06 5:57 
AnswerRe: How to handle a click of a hyperlink Pin
Dustin Metzgar22-Jun-06 4:58
Dustin Metzgar22-Jun-06 4:58 
GeneralRe: How to handle a click of a hyperlink Pin
widget122-Jun-06 5:08
widget122-Jun-06 5:08 
GeneralRe: How to handle a click of a hyperlink Pin
Dustin Metzgar22-Jun-06 5:21
Dustin Metzgar22-Jun-06 5:21 

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.