Adding webcontrols.table to aspx - not rendering

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Sue@ojd.state.or.us

    #1

    Adding webcontrols.table to aspx - not rendering

    On code-behind page:
    (attributes set programatically for each of these elements)
    linkbutton added to tablecell
    textbox added to tablecell
    tablecells added to tablerow
    tablerow added to table (table.ID is TestTable)
    On .aspx page:
    <HeaderTemplate >
    <asp:Table ID="TestTable" runat="Server" />
    </HeaderTemplate>

    Source code on .aspx page in browser shows the table and it's controls are
    correctly created and placed. Controls for the Linkbutton and Textbox do
    not display in browser. I suspect it has something to do with the
    runat="server" attribute for the linkbutton or textbox for which I do not
    find an attribute I can set (e.g. linkbutton.runa t = "server"). Any ideas
    on how I can get these elements to display?

    tia,
    Sue W.

  • Lewis Wang [MSFT]

    #2
    RE: Adding webcontrols.tab le to aspx - not rendering

    Hi Sue,

    This problem doesn't occur to the following code snippet. Does it work on
    your side? If so, you may want to show me the code snippet on your side so
    that I can test it. Thanks.

    private void Page_Load(objec t sender, System.EventArg s e)
    {
    int numrows = 3;
    int numcells = 2;
    for (int j=0; j<numrows; j++)
    {
    TableRow r = new TableRow();
    for (int i=0; i<numcells; i++)
    {
    TableCell c = new TableCell();
    LinkButton lb=new LinkButton ();

    lb.Text=i.ToStr ing();
    if(i==0)c.Contr ols.Add(lb);
    else c.Controls.Add( new TextBox());
    r.Cells.Add(c);
    }
    Table1.Rows.Add (r);
    }
    }

    Best Regards,
    Lewis Wang
    Support Professional

    This posting is provided "AS IS" with no warranties, and confers no rights.


    --------------------
    | MIME-Version: 1.0
    | X-MIMETrack: Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
    6.0.1|February
    | 07, 2003) at 07/23/2003 11:45:57 AM,
    | Serialize complete at 07/23/2003 11:45:57 AM,
    | Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
    6.0.1|February
    | 07, 2003) at 07/23/2003 11:46:02 AM,
    | Serialize complete at 07/23/2003 11:46:02 AM
    | From: Sue@ojd.state.o r.us
    | Subject: Adding webcontrols.tab le to aspx - not rendering
    | X-Newsreader: Lotus Notes Release 6.0.1 February 07, 2003
    | Content-Type: text/plain; charset="US-ASCII"
    | Message-ID: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
    | Newsgroups: microsoft.publi c.dotnet.genera l
    | Date: Wed, 23 Jul 2003 11:46:03 -0700
    | NNTP-Posting-Host: 159.121.96.200
    | Lines: 1
    | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
    | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102197
    | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
    |
    | On code-behind page:
    | (attributes set programatically for each of these elements)
    | linkbutton added to tablecell
    | textbox added to tablecell
    | tablecells added to tablerow
    | tablerow added to table (table.ID is TestTable)
    | On .aspx page:
    | <HeaderTemplate >
    | <asp:Table ID="TestTable" runat="Server" />
    | </HeaderTemplate>
    |
    | Source code on .aspx page in browser shows the table and it's controls
    are
    | correctly created and placed. Controls for the Linkbutton and Textbox do
    | not display in browser. I suspect it has something to do with the
    | runat="server" attribute for the linkbutton or textbox for which I do not
    | find an attribute I can set (e.g. linkbutton.runa t = "server"). Any ideas
    | on how I can get these elements to display?
    |
    | tia,
    | Sue W.
    |
    |

    Comment

    • Lewis Wang [MSFT]

      #3
      RE: Adding webcontrols.tab le to aspx - not rendering

      Hi Sue,

      This problem doesn't occur to the following code snippet. Does it work on
      your side? If so, you may want to show me the code snippet on your side so
      that I can test it. Thanks.

      private void Page_Load(objec t sender, System.EventArg s e)
      {
      int numrows = 3;
      int numcells = 2;
      for (int j=0; j<numrows; j++)
      {
      TableRow r = new TableRow();
      for (int i=0; i<numcells; i++)
      {
      TableCell c = new TableCell();
      LinkButton lb=new LinkButton ();

      lb.Text=i.ToStr ing();
      if(i==0)c.Contr ols.Add(lb);
      else c.Controls.Add( new TextBox());
      r.Cells.Add(c);
      }
      Table1.Rows.Add (r);
      }
      }

      Best Regards,
      Lewis Wang
      Support Professional

      This posting is provided "AS IS" with no warranties, and confers no rights.


      --------------------
      | MIME-Version: 1.0
      | X-MIMETrack: Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
      6.0.1|February
      | 07, 2003) at 07/23/2003 11:45:57 AM,
      | Serialize complete at 07/23/2003 11:45:57 AM,
      | Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
      6.0.1|February
      | 07, 2003) at 07/23/2003 11:46:02 AM,
      | Serialize complete at 07/23/2003 11:46:02 AM
      | From: Sue@ojd.state.o r.us
      | Subject: Adding webcontrols.tab le to aspx - not rendering
      | X-Newsreader: Lotus Notes Release 6.0.1 February 07, 2003
      | Content-Type: text/plain; charset="US-ASCII"
      | Message-ID: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
      | Newsgroups: microsoft.publi c.dotnet.genera l
      | Date: Wed, 23 Jul 2003 11:46:03 -0700
      | NNTP-Posting-Host: 159.121.96.200
      | Lines: 1
      | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102197
      | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
      |
      | On code-behind page:
      | (attributes set programatically for each of these elements)
      | linkbutton added to tablecell
      | textbox added to tablecell
      | tablecells added to tablerow
      | tablerow added to table (table.ID is TestTable)
      | On .aspx page:
      | <HeaderTemplate >
      | <asp:Table ID="TestTable" runat="Server" />
      | </HeaderTemplate>
      |
      | Source code on .aspx page in browser shows the table and it's controls
      are
      | correctly created and placed. Controls for the Linkbutton and Textbox do
      | not display in browser. I suspect it has something to do with the
      | runat="server" attribute for the linkbutton or textbox for which I do not
      | find an attribute I can set (e.g. linkbutton.runa t = "server"). Any ideas
      | on how I can get these elements to display?
      |
      | tia,
      | Sue W.
      |
      |

      Comment

      • Lewis Wang [MSFT]

        #4
        RE: Adding webcontrols.tab le to aspx - not rendering

        Hi Sue,

        This problem doesn't occur to the following code snippet. Does it work on
        your side? If so, you may want to show me the code snippet on your side so
        that I can test it. Thanks.

        private void Page_Load(objec t sender, System.EventArg s e)
        {
        int numrows = 3;
        int numcells = 2;
        for (int j=0; j<numrows; j++)
        {
        TableRow r = new TableRow();
        for (int i=0; i<numcells; i++)
        {
        TableCell c = new TableCell();
        LinkButton lb=new LinkButton ();

        lb.Text=i.ToStr ing();
        if(i==0)c.Contr ols.Add(lb);
        else c.Controls.Add( new TextBox());
        r.Cells.Add(c);
        }
        Table1.Rows.Add (r);
        }
        }

        Best Regards,
        Lewis Wang
        Support Professional

        This posting is provided "AS IS" with no warranties, and confers no rights.


        --------------------
        | MIME-Version: 1.0
        | X-MIMETrack: Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
        6.0.1|February
        | 07, 2003) at 07/23/2003 11:45:57 AM,
        | Serialize complete at 07/23/2003 11:45:57 AM,
        | Serialize by Notes Client on Susan L WILLIS/MUL/OJD(Release
        6.0.1|February
        | 07, 2003) at 07/23/2003 11:46:02 AM,
        | Serialize complete at 07/23/2003 11:46:02 AM
        | From: Sue@ojd.state.o r.us
        | Subject: Adding webcontrols.tab le to aspx - not rendering
        | X-Newsreader: Lotus Notes Release 6.0.1 February 07, 2003
        | Content-Type: text/plain; charset="US-ASCII"
        | Message-ID: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
        | Newsgroups: microsoft.publi c.dotnet.genera l
        | Date: Wed, 23 Jul 2003 11:46:03 -0700
        | NNTP-Posting-Host: 159.121.96.200
        | Lines: 1
        | Path: cpmsftngxa06.ph x.gbl!TK2MSFTNG P08.phx.gbl!TK2 MSFTNGP09.phx.g bl
        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102197
        | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
        |
        | On code-behind page:
        | (attributes set programatically for each of these elements)
        | linkbutton added to tablecell
        | textbox added to tablecell
        | tablecells added to tablerow
        | tablerow added to table (table.ID is TestTable)
        | On .aspx page:
        | <HeaderTemplate >
        | <asp:Table ID="TestTable" runat="Server" />
        | </HeaderTemplate>
        |
        | Source code on .aspx page in browser shows the table and it's controls
        are
        | correctly created and placed. Controls for the Linkbutton and Textbox do
        | not display in browser. I suspect it has something to do with the
        | runat="server" attribute for the linkbutton or textbox for which I do not
        | find an attribute I can set (e.g. linkbutton.runa t = "server"). Any ideas
        | on how I can get these elements to display?
        |
        | tia,
        | Sue W.
        |
        |

        Comment

        • Lewis Wang [MSFT]

          #5
          RE: Adding webcontrols.tab le to aspx - not rendering

          Hi Sue,

          Thank you for your feedback.

          Do you want to add a textbox and a linkbutton into table programmingly,
          then put the table into a HeaderTemplate of datagrid's column? The
          following code snippet demonstrates this.

          If I misunderstood your concern, would you please provide more explanations
          on your requirement? Thank you.

          Dim CaseNumberHeade rTable As Table

          Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object, ByVal e
          As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
          DataGrid1.ItemD ataBound
          If e.Item.ItemType = ListItemType.He ader Then
          CaseNumberHeade rTable =
          CType(e.Item.Fi ndControl("Case NumberHeaderTab le"), Table)
          setCaseNumberHe aderTable()
          End If

          End Sub

          Private Sub setCaseNumberHe aderTable()

          Dim CaseNumberHRow1 As TableRow = New TableRow
          Dim CaseNumberHRow2 As TableRow = New TableRow
          Dim CaseNumberHCell 1 As TableCell = New TableCell
          Dim CaseNumberHCell 2 As TableCell = New TableCell

          Dim CaseNumberSortB utton As LinkButton = New LinkButton
          Dim CaseNumberFilte rBox As TextBox = New TextBox

          CaseNumberSortB utton.ID = "CaseNumberSort Button"
          CaseNumberSortB utton.Text = "Sort CaseNo"
          CaseNumberSortB utton.ToolTip = "Click to sort the case number
          column"

          CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
          CaseNumberFilte rBox.ToolTip = "Enter case number on which to filter
          records"

          CaseNumberHCell 1.VerticalAlign = VerticalAlign.B ottom
          CaseNumberHCell 1.HorizontalAli gn = HorizontalAlign .Center
          CaseNumberHCell 1.Controls.Add( CaseNumberSortB utton)

          CaseNumberHCell 2.VerticalAlign = VerticalAlign.T op
          CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
          CaseNumberHCell 2.Controls.Add( CaseNumberFilte rBox)
          CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
          CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
          CaseNumberHeade rTable.Controls .Add(CaseNumber HRow1)
          CaseNumberHeade rTable.Controls .Add(CaseNumber HRow2)
          CaseNumberHeade rTable.ID = "CaseNumberHead erTable"
          CaseNumberHeade rTable.BorderCo lor = Color.Blue
          End Sub


          Lewis Wang

          This posting is provided "AS IS" with no warranties, and confers no rights.
          --------------------
          | Content-Class: urn:content-classes:message
          | From: "Sue" <Sue@ojd.state. or.us>
          | Sender: "Sue" <Sue@ojd.state. or.us>
          | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
          <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
          | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
          | Date: Thu, 24 Jul 2003 11:38:45 -0700
          | Lines: 87
          | Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
          | MIME-Version: 1.0
          | Content-Type: text/plain;
          | charset="iso-8859-1"
          | Content-Transfer-Encoding: 7bit
          | X-Newsreader: Microsoft CDO for Windows 2000
          | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
          | Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
          | Newsgroups: microsoft.publi c.dotnet.genera l
          | Path: cpmsftngxa06.ph x.gbl
          | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102328
          | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
          | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
          |
          | >your side? If so, you may want to show me the code
          | snippet on your side so
          | >that I can test it. Thanks.
          |
          | Lewis, tried your code, but I'm working in VB and
          | couldn't remember half of how to get things set up for C
          | (#?). I do have a similar table working just find
          | further up in the web page. It's not part of a datagrid
          | though. Below is the relevant code for this problem.
          |
          | Protected WithEvents CaseNumberSortB utton As LinkButton =
          | LinkButton
          | Protected WithEvents CaseNumberFilte rBox As TextBox = New
          | TextBox
          | Protected WithEvents CaseNumberHeade rTable As Table = New
          | Table
          | Protected WithEvents CaseNumberHRow1 As TableRow = New
          | TableRow
          | Protected WithEvents CaseNumberHRow2 As TableRow = New
          | TableRow
          | Protected WithEvents CaseNumberHCell 1 As TableCell = New
          | TableCell
          | Protected WithEvents CaseNumberHCell 2 As TableCell = New
          | TableCell
          |
          | Private Sub Page_Load(ByVal sender As System.Object,
          | ByVal e As System.EventArg s) Handles MyBase.Load
          | Call setCaseNumberHe aderTable()
          | End Sub
          |
          | Public Sub setCaseNumberHe aderTable()
          | With CaseNumberSortB utton
          | .ID = "CaseNumberSort Button"
          | .Text = "Sort CaseNo"
          | .ToolTip = "Click to sort the case number column"
          | End With
          | With CaseNumberFilte rBox
          | .ID = "CaseNumberFilt erBox"
          | .ToolTip = "Enter case number on which to filter
          | records"
          | End With
          | With Me.CaseNumberHC ell1
          | .VerticalAlign = VerticalAlign.B ottom
          | .HorizontalAlig n = HorizontalAlign .Center
          | .Controls.Add(C aseNumberSortBu tton)
          | End With
          | With CaseNumberHCell 2
          | .VerticalAlign = VerticalAlign.T op
          | .Text = "Filter by: <BR><HR><BR>"
          | .Controls.Add(C aseNumberFilter Box)
          | End With
          | With Me.CaseNumberHR ow1
          | .Controls.Add(C aseNumberHCell1 )
          | End With
          | With CaseNumberHRow2
          | .Controls.Add(C aseNumberHCell2 )
          | End With
          | With CaseNumberHeade rTable
          | .Controls.Add(C aseNumberHRow1)
          | .Controls.Add(C aseNumberHRow2)
          | .ID = "CaseNumberHead erTable"
          | .Width.Percenta ge(100)
          | End With
          | End Sub
          |
          | .aspx file:
          |
          | <asp:datagrid id=DG runat="server">
          | <Columns>
          | <asp:TemplateCo lumn SortExpression= "CaseNo">
          | <HeaderTemplate >
          | <asp:Table ID="CaseNumberH eaderTable"
          | Runat="Server" />
          | </HeaderTemplate>
          | ......
          | </asp:TemplateCol umn>
          | </Columns>
          | </asp:Datagrid>
          |
          | Any help appreciated...
          |
          | Sue
          |
          |
          |
          |
          |
          |

          Comment

          • Lewis Wang [MSFT]

            #6
            RE: Adding webcontrols.tab le to aspx - not rendering

            Hi Sue,

            Thank you for your feedback.

            Do you want to add a textbox and a linkbutton into table programmingly,
            then put the table into a HeaderTemplate of datagrid's column? The
            following code snippet demonstrates this.

            If I misunderstood your concern, would you please provide more explanations
            on your requirement? Thank you.

            Dim CaseNumberHeade rTable As Table

            Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object, ByVal e
            As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
            DataGrid1.ItemD ataBound
            If e.Item.ItemType = ListItemType.He ader Then
            CaseNumberHeade rTable =
            CType(e.Item.Fi ndControl("Case NumberHeaderTab le"), Table)
            setCaseNumberHe aderTable()
            End If

            End Sub

            Private Sub setCaseNumberHe aderTable()

            Dim CaseNumberHRow1 As TableRow = New TableRow
            Dim CaseNumberHRow2 As TableRow = New TableRow
            Dim CaseNumberHCell 1 As TableCell = New TableCell
            Dim CaseNumberHCell 2 As TableCell = New TableCell

            Dim CaseNumberSortB utton As LinkButton = New LinkButton
            Dim CaseNumberFilte rBox As TextBox = New TextBox

            CaseNumberSortB utton.ID = "CaseNumberSort Button"
            CaseNumberSortB utton.Text = "Sort CaseNo"
            CaseNumberSortB utton.ToolTip = "Click to sort the case number
            column"

            CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
            CaseNumberFilte rBox.ToolTip = "Enter case number on which to filter
            records"

            CaseNumberHCell 1.VerticalAlign = VerticalAlign.B ottom
            CaseNumberHCell 1.HorizontalAli gn = HorizontalAlign .Center
            CaseNumberHCell 1.Controls.Add( CaseNumberSortB utton)

            CaseNumberHCell 2.VerticalAlign = VerticalAlign.T op
            CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
            CaseNumberHCell 2.Controls.Add( CaseNumberFilte rBox)
            CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
            CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
            CaseNumberHeade rTable.Controls .Add(CaseNumber HRow1)
            CaseNumberHeade rTable.Controls .Add(CaseNumber HRow2)
            CaseNumberHeade rTable.ID = "CaseNumberHead erTable"
            CaseNumberHeade rTable.BorderCo lor = Color.Blue
            End Sub


            Lewis Wang

            This posting is provided "AS IS" with no warranties, and confers no rights.
            --------------------
            | Content-Class: urn:content-classes:message
            | From: "Sue" <Sue@ojd.state. or.us>
            | Sender: "Sue" <Sue@ojd.state. or.us>
            | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
            <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
            | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
            | Date: Thu, 24 Jul 2003 11:38:45 -0700
            | Lines: 87
            | Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
            | MIME-Version: 1.0
            | Content-Type: text/plain;
            | charset="iso-8859-1"
            | Content-Transfer-Encoding: 7bit
            | X-Newsreader: Microsoft CDO for Windows 2000
            | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
            | Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
            | Newsgroups: microsoft.publi c.dotnet.genera l
            | Path: cpmsftngxa06.ph x.gbl
            | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102328
            | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
            | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
            |
            | >your side? If so, you may want to show me the code
            | snippet on your side so
            | >that I can test it. Thanks.
            |
            | Lewis, tried your code, but I'm working in VB and
            | couldn't remember half of how to get things set up for C
            | (#?). I do have a similar table working just find
            | further up in the web page. It's not part of a datagrid
            | though. Below is the relevant code for this problem.
            |
            | Protected WithEvents CaseNumberSortB utton As LinkButton =
            | LinkButton
            | Protected WithEvents CaseNumberFilte rBox As TextBox = New
            | TextBox
            | Protected WithEvents CaseNumberHeade rTable As Table = New
            | Table
            | Protected WithEvents CaseNumberHRow1 As TableRow = New
            | TableRow
            | Protected WithEvents CaseNumberHRow2 As TableRow = New
            | TableRow
            | Protected WithEvents CaseNumberHCell 1 As TableCell = New
            | TableCell
            | Protected WithEvents CaseNumberHCell 2 As TableCell = New
            | TableCell
            |
            | Private Sub Page_Load(ByVal sender As System.Object,
            | ByVal e As System.EventArg s) Handles MyBase.Load
            | Call setCaseNumberHe aderTable()
            | End Sub
            |
            | Public Sub setCaseNumberHe aderTable()
            | With CaseNumberSortB utton
            | .ID = "CaseNumberSort Button"
            | .Text = "Sort CaseNo"
            | .ToolTip = "Click to sort the case number column"
            | End With
            | With CaseNumberFilte rBox
            | .ID = "CaseNumberFilt erBox"
            | .ToolTip = "Enter case number on which to filter
            | records"
            | End With
            | With Me.CaseNumberHC ell1
            | .VerticalAlign = VerticalAlign.B ottom
            | .HorizontalAlig n = HorizontalAlign .Center
            | .Controls.Add(C aseNumberSortBu tton)
            | End With
            | With CaseNumberHCell 2
            | .VerticalAlign = VerticalAlign.T op
            | .Text = "Filter by: <BR><HR><BR>"
            | .Controls.Add(C aseNumberFilter Box)
            | End With
            | With Me.CaseNumberHR ow1
            | .Controls.Add(C aseNumberHCell1 )
            | End With
            | With CaseNumberHRow2
            | .Controls.Add(C aseNumberHCell2 )
            | End With
            | With CaseNumberHeade rTable
            | .Controls.Add(C aseNumberHRow1)
            | .Controls.Add(C aseNumberHRow2)
            | .ID = "CaseNumberHead erTable"
            | .Width.Percenta ge(100)
            | End With
            | End Sub
            |
            | .aspx file:
            |
            | <asp:datagrid id=DG runat="server">
            | <Columns>
            | <asp:TemplateCo lumn SortExpression= "CaseNo">
            | <HeaderTemplate >
            | <asp:Table ID="CaseNumberH eaderTable"
            | Runat="Server" />
            | </HeaderTemplate>
            | ......
            | </asp:TemplateCol umn>
            | </Columns>
            | </asp:Datagrid>
            |
            | Any help appreciated...
            |
            | Sue
            |
            |
            |
            |
            |
            |

            Comment

            • Lewis Wang [MSFT]

              #7
              RE: Adding webcontrols.tab le to aspx - not rendering

              Hi Sue,

              Thank you for your feedback.

              Do you want to add a textbox and a linkbutton into table programmingly,
              then put the table into a HeaderTemplate of datagrid's column? The
              following code snippet demonstrates this.

              If I misunderstood your concern, would you please provide more explanations
              on your requirement? Thank you.

              Dim CaseNumberHeade rTable As Table

              Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object, ByVal e
              As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
              DataGrid1.ItemD ataBound
              If e.Item.ItemType = ListItemType.He ader Then
              CaseNumberHeade rTable =
              CType(e.Item.Fi ndControl("Case NumberHeaderTab le"), Table)
              setCaseNumberHe aderTable()
              End If

              End Sub

              Private Sub setCaseNumberHe aderTable()

              Dim CaseNumberHRow1 As TableRow = New TableRow
              Dim CaseNumberHRow2 As TableRow = New TableRow
              Dim CaseNumberHCell 1 As TableCell = New TableCell
              Dim CaseNumberHCell 2 As TableCell = New TableCell

              Dim CaseNumberSortB utton As LinkButton = New LinkButton
              Dim CaseNumberFilte rBox As TextBox = New TextBox

              CaseNumberSortB utton.ID = "CaseNumberSort Button"
              CaseNumberSortB utton.Text = "Sort CaseNo"
              CaseNumberSortB utton.ToolTip = "Click to sort the case number
              column"

              CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
              CaseNumberFilte rBox.ToolTip = "Enter case number on which to filter
              records"

              CaseNumberHCell 1.VerticalAlign = VerticalAlign.B ottom
              CaseNumberHCell 1.HorizontalAli gn = HorizontalAlign .Center
              CaseNumberHCell 1.Controls.Add( CaseNumberSortB utton)

              CaseNumberHCell 2.VerticalAlign = VerticalAlign.T op
              CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
              CaseNumberHCell 2.Controls.Add( CaseNumberFilte rBox)
              CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
              CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
              CaseNumberHeade rTable.Controls .Add(CaseNumber HRow1)
              CaseNumberHeade rTable.Controls .Add(CaseNumber HRow2)
              CaseNumberHeade rTable.ID = "CaseNumberHead erTable"
              CaseNumberHeade rTable.BorderCo lor = Color.Blue
              End Sub


              Lewis Wang

              This posting is provided "AS IS" with no warranties, and confers no rights.
              --------------------
              | Content-Class: urn:content-classes:message
              | From: "Sue" <Sue@ojd.state. or.us>
              | Sender: "Sue" <Sue@ojd.state. or.us>
              | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
              <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
              | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
              | Date: Thu, 24 Jul 2003 11:38:45 -0700
              | Lines: 87
              | Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
              | MIME-Version: 1.0
              | Content-Type: text/plain;
              | charset="iso-8859-1"
              | Content-Transfer-Encoding: 7bit
              | X-Newsreader: Microsoft CDO for Windows 2000
              | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
              | Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
              | Newsgroups: microsoft.publi c.dotnet.genera l
              | Path: cpmsftngxa06.ph x.gbl
              | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102328
              | NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
              | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
              |
              | >your side? If so, you may want to show me the code
              | snippet on your side so
              | >that I can test it. Thanks.
              |
              | Lewis, tried your code, but I'm working in VB and
              | couldn't remember half of how to get things set up for C
              | (#?). I do have a similar table working just find
              | further up in the web page. It's not part of a datagrid
              | though. Below is the relevant code for this problem.
              |
              | Protected WithEvents CaseNumberSortB utton As LinkButton =
              | LinkButton
              | Protected WithEvents CaseNumberFilte rBox As TextBox = New
              | TextBox
              | Protected WithEvents CaseNumberHeade rTable As Table = New
              | Table
              | Protected WithEvents CaseNumberHRow1 As TableRow = New
              | TableRow
              | Protected WithEvents CaseNumberHRow2 As TableRow = New
              | TableRow
              | Protected WithEvents CaseNumberHCell 1 As TableCell = New
              | TableCell
              | Protected WithEvents CaseNumberHCell 2 As TableCell = New
              | TableCell
              |
              | Private Sub Page_Load(ByVal sender As System.Object,
              | ByVal e As System.EventArg s) Handles MyBase.Load
              | Call setCaseNumberHe aderTable()
              | End Sub
              |
              | Public Sub setCaseNumberHe aderTable()
              | With CaseNumberSortB utton
              | .ID = "CaseNumberSort Button"
              | .Text = "Sort CaseNo"
              | .ToolTip = "Click to sort the case number column"
              | End With
              | With CaseNumberFilte rBox
              | .ID = "CaseNumberFilt erBox"
              | .ToolTip = "Enter case number on which to filter
              | records"
              | End With
              | With Me.CaseNumberHC ell1
              | .VerticalAlign = VerticalAlign.B ottom
              | .HorizontalAlig n = HorizontalAlign .Center
              | .Controls.Add(C aseNumberSortBu tton)
              | End With
              | With CaseNumberHCell 2
              | .VerticalAlign = VerticalAlign.T op
              | .Text = "Filter by: <BR><HR><BR>"
              | .Controls.Add(C aseNumberFilter Box)
              | End With
              | With Me.CaseNumberHR ow1
              | .Controls.Add(C aseNumberHCell1 )
              | End With
              | With CaseNumberHRow2
              | .Controls.Add(C aseNumberHCell2 )
              | End With
              | With CaseNumberHeade rTable
              | .Controls.Add(C aseNumberHRow1)
              | .Controls.Add(C aseNumberHRow2)
              | .ID = "CaseNumberHead erTable"
              | .Width.Percenta ge(100)
              | End With
              | End Sub
              |
              | .aspx file:
              |
              | <asp:datagrid id=DG runat="server">
              | <Columns>
              | <asp:TemplateCo lumn SortExpression= "CaseNo">
              | <HeaderTemplate >
              | <asp:Table ID="CaseNumberH eaderTable"
              | Runat="Server" />
              | </HeaderTemplate>
              | ......
              | </asp:TemplateCol umn>
              | </Columns>
              | </asp:Datagrid>
              |
              | Any help appreciated...
              |
              | Sue
              |
              |
              |
              |
              |
              |

              Comment

              • Sue

                #8
                RE: Adding webcontrols.tab le to aspx - not rendering

                >If I misunderstood your concern, would you please
                provide more explanations[color=blue]
                >on your requirement? Thank you.[/color]

                This is exactly what I wish to do. I have tried the code
                below (modified for my object names) and got an invalid
                cast error message at the CType line. I know this is
                simple, I'm just not tripping onto the correct syntax
                <sigh>. I've tried various options for the CType without
                success. Any other ideas?

                tia,
                Sue
                [color=blue]
                >
                >Dim CaseNumberHeade rTable As Table
                >
                >Private Sub DataGrid1_ItemD ataBound(ByVal sender As[/color]
                System.Object, ByVal e[color=blue]
                >As System.Web.UI.W ebControls.Data GridItemEventAr gs)[/color]
                Handles[color=blue]
                >DataGrid1.Item DataBound
                > If e.Item.ItemType = ListItemType.He ader Then
                > CaseNumberHeade rTable =
                >CType(e.Item.F indControl("Cas eNumberHeaderTa ble"), Table)
                > setCaseNumberHe aderTable()
                > End If
                >
                > End Sub
                >
                >Private Sub setCaseNumberHe aderTable()
                >
                > Dim CaseNumberHRow1 As TableRow = New TableRow
                > Dim CaseNumberHRow2 As TableRow = New TableRow
                > Dim CaseNumberHCell 1 As TableCell = New TableCell
                > Dim CaseNumberHCell 2 As TableCell = New TableCell
                >
                > Dim CaseNumberSortB utton As LinkButton = New[/color]
                LinkButton[color=blue]
                > Dim CaseNumberFilte rBox As TextBox = New TextBox
                >
                > CaseNumberSortB utton.ID = "CaseNumberSort Button"
                > CaseNumberSortB utton.Text = "Sort CaseNo"
                > CaseNumberSortB utton.ToolTip = "Click to sort[/color]
                the case number[color=blue]
                >column"
                >
                > CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
                > CaseNumberFilte rBox.ToolTip = "Enter case number[/color]
                on which to filter[color=blue]
                >records"
                >
                > CaseNumberHCell 1.VerticalAlign =[/color]
                VerticalAlign.B ottom[color=blue]
                > CaseNumberHCell 1.HorizontalAli gn =[/color]
                HorizontalAlign .Center[color=blue]
                > CaseNumberHCell 1.Controls.Add[/color]
                (CaseNumberSort Button)[color=blue]
                >
                > CaseNumberHCell 2.VerticalAlign =[/color]
                VerticalAlign.T op[color=blue]
                > CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
                > CaseNumberHCell 2.Controls.Add[/color]
                (CaseNumberFilt erBox)[color=blue]
                > CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
                > CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
                > CaseNumberHeade rTable.Controls .Add[/color]
                (CaseNumberHRow 1)[color=blue]
                > CaseNumberHeade rTable.Controls .Add[/color]
                (CaseNumberHRow 2)[color=blue]
                > CaseNumberHeade rTable.ID[/color]
                = "CaseNumberHead erTable"[color=blue]
                > CaseNumberHeade rTable.BorderCo lor = Color.Blue
                > End Sub
                >
                >
                >Lewis Wang
                >
                >This posting is provided "AS IS" with no warranties, and[/color]
                confers no rights.[color=blue]
                >--------------------
                >| Content-Class: urn:content-classes:message
                >| From: "Sue" <Sue@ojd.state. or.us>
                >| Sender: "Sue" <Sue@ojd.state. or.us>
                >| References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                ><Dysu1QeUDHA.1 688@cpmsftngxa0 6.phx.gbl>
                >| Subject: RE: Adding webcontrols.tab le to aspx - not[/color]
                rendering[color=blue]
                >| Date: Thu, 24 Jul 2003 11:38:45 -0700
                >| Lines: 87
                >| Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                >| MIME-Version: 1.0
                >| Content-Type: text/plain;
                >| charset="iso-8859-1"
                >| Content-Transfer-Encoding: 7bit
                >| X-Newsreader: Microsoft CDO for Windows 2000
                >| X-MimeOLE: Produced By Microsoft MimeOLE[/color]
                V5.50.4910.0300[color=blue]
                >| Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
                >| Newsgroups: microsoft.publi c.dotnet.genera l
                >| Path: cpmsftngxa06.ph x.gbl
                >| Xref: cpmsftngxa06.ph x.gbl[/color]
                microsoft.publi c.dotnet.genera l:102328[color=blue]
                >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
                >| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                >|
                >| >your side? If so, you may want to show me the code
                >| snippet on your side so
                >| >that I can test it. Thanks.
                >|
                >| Lewis, tried your code, but I'm working in VB and
                >| couldn't remember half of how to get things set up for[/color]
                C[color=blue]
                >| (#?). I do have a similar table working just find
                >| further up in the web page. It's not part of a[/color]
                datagrid[color=blue]
                >| though. Below is the relevant code for this problem.
                >|
                >| Protected WithEvents CaseNumberSortB utton As[/color]
                LinkButton =[color=blue]
                >| LinkButton
                >| Protected WithEvents CaseNumberFilte rBox As TextBox =[/color]
                New[color=blue]
                >| TextBox
                >| Protected WithEvents CaseNumberHeade rTable As Table =[/color]
                New[color=blue]
                >| Table
                >| Protected WithEvents CaseNumberHRow1 As TableRow = New
                >| TableRow
                >| Protected WithEvents CaseNumberHRow2 As TableRow = New
                >| TableRow
                >| Protected WithEvents CaseNumberHCell 1 As TableCell =[/color]
                New[color=blue]
                >| TableCell
                >| Protected WithEvents CaseNumberHCell 2 As TableCell =[/color]
                New[color=blue]
                >| TableCell
                >|
                >| Private Sub Page_Load(ByVal sender As System.Object,
                >| ByVal e As System.EventArg s) Handles MyBase.Load
                >| Call setCaseNumberHe aderTable()
                >| End Sub
                >|
                >| Public Sub setCaseNumberHe aderTable()
                >| With CaseNumberSortB utton
                >| .ID = "CaseNumberSort Button"
                >| .Text = "Sort CaseNo"
                >| .ToolTip = "Click to sort the case number column"
                >| End With
                >| With CaseNumberFilte rBox
                >| .ID = "CaseNumberFilt erBox"
                >| .ToolTip = "Enter case number on which to filter
                >| records"
                >| End With
                >| With Me.CaseNumberHC ell1
                >| .VerticalAlign = VerticalAlign.B ottom
                >| .HorizontalAlig n = HorizontalAlign .Center
                >| .Controls.Add(C aseNumberSortBu tton)
                >| End With
                >| With CaseNumberHCell 2
                >| .VerticalAlign = VerticalAlign.T op
                >| .Text = "Filter by: <BR><HR><BR>"
                >| .Controls.Add(C aseNumberFilter Box)
                >| End With
                >| With Me.CaseNumberHR ow1
                >| .Controls.Add(C aseNumberHCell1 )
                >| End With
                >| With CaseNumberHRow2
                >| .Controls.Add(C aseNumberHCell2 )
                >| End With
                >| With CaseNumberHeade rTable
                >| .Controls.Add(C aseNumberHRow1)
                >| .Controls.Add(C aseNumberHRow2)
                >| .ID = "CaseNumberHead erTable"
                >| .Width.Percenta ge(100)
                >| End With
                >| End Sub
                >|
                >| .aspx file:
                >|
                >| <asp:datagrid id=DG runat="server">
                >| <Columns>
                >| <asp:TemplateCo lumn SortExpression= "CaseNo">
                >| <HeaderTemplate >
                >| <asp:Table ID="CaseNumberH eaderTable"
                >| Runat="Server" />
                >| </HeaderTemplate>
                >| ......
                >| </asp:TemplateCol umn>
                >| </Columns>
                >| </asp:Datagrid>
                >|
                >| Any help appreciated...
                >|
                >| Sue
                >|
                >|
                >|
                >|
                >|
                >|
                >
                >.
                >[/color]

                Comment

                • Sue

                  #9
                  RE: Adding webcontrols.tab le to aspx - not rendering

                  >If I misunderstood your concern, would you please
                  provide more explanations[color=blue]
                  >on your requirement? Thank you.[/color]

                  This is exactly what I wish to do. I have tried the code
                  below (modified for my object names) and got an invalid
                  cast error message at the CType line. I know this is
                  simple, I'm just not tripping onto the correct syntax
                  <sigh>. I've tried various options for the CType without
                  success. Any other ideas?

                  tia,
                  Sue
                  [color=blue]
                  >
                  >Dim CaseNumberHeade rTable As Table
                  >
                  >Private Sub DataGrid1_ItemD ataBound(ByVal sender As[/color]
                  System.Object, ByVal e[color=blue]
                  >As System.Web.UI.W ebControls.Data GridItemEventAr gs)[/color]
                  Handles[color=blue]
                  >DataGrid1.Item DataBound
                  > If e.Item.ItemType = ListItemType.He ader Then
                  > CaseNumberHeade rTable =
                  >CType(e.Item.F indControl("Cas eNumberHeaderTa ble"), Table)
                  > setCaseNumberHe aderTable()
                  > End If
                  >
                  > End Sub
                  >
                  >Private Sub setCaseNumberHe aderTable()
                  >
                  > Dim CaseNumberHRow1 As TableRow = New TableRow
                  > Dim CaseNumberHRow2 As TableRow = New TableRow
                  > Dim CaseNumberHCell 1 As TableCell = New TableCell
                  > Dim CaseNumberHCell 2 As TableCell = New TableCell
                  >
                  > Dim CaseNumberSortB utton As LinkButton = New[/color]
                  LinkButton[color=blue]
                  > Dim CaseNumberFilte rBox As TextBox = New TextBox
                  >
                  > CaseNumberSortB utton.ID = "CaseNumberSort Button"
                  > CaseNumberSortB utton.Text = "Sort CaseNo"
                  > CaseNumberSortB utton.ToolTip = "Click to sort[/color]
                  the case number[color=blue]
                  >column"
                  >
                  > CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
                  > CaseNumberFilte rBox.ToolTip = "Enter case number[/color]
                  on which to filter[color=blue]
                  >records"
                  >
                  > CaseNumberHCell 1.VerticalAlign =[/color]
                  VerticalAlign.B ottom[color=blue]
                  > CaseNumberHCell 1.HorizontalAli gn =[/color]
                  HorizontalAlign .Center[color=blue]
                  > CaseNumberHCell 1.Controls.Add[/color]
                  (CaseNumberSort Button)[color=blue]
                  >
                  > CaseNumberHCell 2.VerticalAlign =[/color]
                  VerticalAlign.T op[color=blue]
                  > CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
                  > CaseNumberHCell 2.Controls.Add[/color]
                  (CaseNumberFilt erBox)[color=blue]
                  > CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
                  > CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
                  > CaseNumberHeade rTable.Controls .Add[/color]
                  (CaseNumberHRow 1)[color=blue]
                  > CaseNumberHeade rTable.Controls .Add[/color]
                  (CaseNumberHRow 2)[color=blue]
                  > CaseNumberHeade rTable.ID[/color]
                  = "CaseNumberHead erTable"[color=blue]
                  > CaseNumberHeade rTable.BorderCo lor = Color.Blue
                  > End Sub
                  >
                  >
                  >Lewis Wang
                  >
                  >This posting is provided "AS IS" with no warranties, and[/color]
                  confers no rights.[color=blue]
                  >--------------------
                  >| Content-Class: urn:content-classes:message
                  >| From: "Sue" <Sue@ojd.state. or.us>
                  >| Sender: "Sue" <Sue@ojd.state. or.us>
                  >| References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                  ><Dysu1QeUDHA.1 688@cpmsftngxa0 6.phx.gbl>
                  >| Subject: RE: Adding webcontrols.tab le to aspx - not[/color]
                  rendering[color=blue]
                  >| Date: Thu, 24 Jul 2003 11:38:45 -0700
                  >| Lines: 87
                  >| Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                  >| MIME-Version: 1.0
                  >| Content-Type: text/plain;
                  >| charset="iso-8859-1"
                  >| Content-Transfer-Encoding: 7bit
                  >| X-Newsreader: Microsoft CDO for Windows 2000
                  >| X-MimeOLE: Produced By Microsoft MimeOLE[/color]
                  V5.50.4910.0300[color=blue]
                  >| Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
                  >| Newsgroups: microsoft.publi c.dotnet.genera l
                  >| Path: cpmsftngxa06.ph x.gbl
                  >| Xref: cpmsftngxa06.ph x.gbl[/color]
                  microsoft.publi c.dotnet.genera l:102328[color=blue]
                  >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
                  >| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                  >|
                  >| >your side? If so, you may want to show me the code
                  >| snippet on your side so
                  >| >that I can test it. Thanks.
                  >|
                  >| Lewis, tried your code, but I'm working in VB and
                  >| couldn't remember half of how to get things set up for[/color]
                  C[color=blue]
                  >| (#?). I do have a similar table working just find
                  >| further up in the web page. It's not part of a[/color]
                  datagrid[color=blue]
                  >| though. Below is the relevant code for this problem.
                  >|
                  >| Protected WithEvents CaseNumberSortB utton As[/color]
                  LinkButton =[color=blue]
                  >| LinkButton
                  >| Protected WithEvents CaseNumberFilte rBox As TextBox =[/color]
                  New[color=blue]
                  >| TextBox
                  >| Protected WithEvents CaseNumberHeade rTable As Table =[/color]
                  New[color=blue]
                  >| Table
                  >| Protected WithEvents CaseNumberHRow1 As TableRow = New
                  >| TableRow
                  >| Protected WithEvents CaseNumberHRow2 As TableRow = New
                  >| TableRow
                  >| Protected WithEvents CaseNumberHCell 1 As TableCell =[/color]
                  New[color=blue]
                  >| TableCell
                  >| Protected WithEvents CaseNumberHCell 2 As TableCell =[/color]
                  New[color=blue]
                  >| TableCell
                  >|
                  >| Private Sub Page_Load(ByVal sender As System.Object,
                  >| ByVal e As System.EventArg s) Handles MyBase.Load
                  >| Call setCaseNumberHe aderTable()
                  >| End Sub
                  >|
                  >| Public Sub setCaseNumberHe aderTable()
                  >| With CaseNumberSortB utton
                  >| .ID = "CaseNumberSort Button"
                  >| .Text = "Sort CaseNo"
                  >| .ToolTip = "Click to sort the case number column"
                  >| End With
                  >| With CaseNumberFilte rBox
                  >| .ID = "CaseNumberFilt erBox"
                  >| .ToolTip = "Enter case number on which to filter
                  >| records"
                  >| End With
                  >| With Me.CaseNumberHC ell1
                  >| .VerticalAlign = VerticalAlign.B ottom
                  >| .HorizontalAlig n = HorizontalAlign .Center
                  >| .Controls.Add(C aseNumberSortBu tton)
                  >| End With
                  >| With CaseNumberHCell 2
                  >| .VerticalAlign = VerticalAlign.T op
                  >| .Text = "Filter by: <BR><HR><BR>"
                  >| .Controls.Add(C aseNumberFilter Box)
                  >| End With
                  >| With Me.CaseNumberHR ow1
                  >| .Controls.Add(C aseNumberHCell1 )
                  >| End With
                  >| With CaseNumberHRow2
                  >| .Controls.Add(C aseNumberHCell2 )
                  >| End With
                  >| With CaseNumberHeade rTable
                  >| .Controls.Add(C aseNumberHRow1)
                  >| .Controls.Add(C aseNumberHRow2)
                  >| .ID = "CaseNumberHead erTable"
                  >| .Width.Percenta ge(100)
                  >| End With
                  >| End Sub
                  >|
                  >| .aspx file:
                  >|
                  >| <asp:datagrid id=DG runat="server">
                  >| <Columns>
                  >| <asp:TemplateCo lumn SortExpression= "CaseNo">
                  >| <HeaderTemplate >
                  >| <asp:Table ID="CaseNumberH eaderTable"
                  >| Runat="Server" />
                  >| </HeaderTemplate>
                  >| ......
                  >| </asp:TemplateCol umn>
                  >| </Columns>
                  >| </asp:Datagrid>
                  >|
                  >| Any help appreciated...
                  >|
                  >| Sue
                  >|
                  >|
                  >|
                  >|
                  >|
                  >|
                  >
                  >.
                  >[/color]

                  Comment

                  • Sue

                    #10
                    RE: Adding webcontrols.tab le to aspx - not rendering

                    >If I misunderstood your concern, would you please
                    provide more explanations[color=blue]
                    >on your requirement? Thank you.[/color]

                    This is exactly what I wish to do. I have tried the code
                    below (modified for my object names) and got an invalid
                    cast error message at the CType line. I know this is
                    simple, I'm just not tripping onto the correct syntax
                    <sigh>. I've tried various options for the CType without
                    success. Any other ideas?

                    tia,
                    Sue
                    [color=blue]
                    >
                    >Dim CaseNumberHeade rTable As Table
                    >
                    >Private Sub DataGrid1_ItemD ataBound(ByVal sender As[/color]
                    System.Object, ByVal e[color=blue]
                    >As System.Web.UI.W ebControls.Data GridItemEventAr gs)[/color]
                    Handles[color=blue]
                    >DataGrid1.Item DataBound
                    > If e.Item.ItemType = ListItemType.He ader Then
                    > CaseNumberHeade rTable =
                    >CType(e.Item.F indControl("Cas eNumberHeaderTa ble"), Table)
                    > setCaseNumberHe aderTable()
                    > End If
                    >
                    > End Sub
                    >
                    >Private Sub setCaseNumberHe aderTable()
                    >
                    > Dim CaseNumberHRow1 As TableRow = New TableRow
                    > Dim CaseNumberHRow2 As TableRow = New TableRow
                    > Dim CaseNumberHCell 1 As TableCell = New TableCell
                    > Dim CaseNumberHCell 2 As TableCell = New TableCell
                    >
                    > Dim CaseNumberSortB utton As LinkButton = New[/color]
                    LinkButton[color=blue]
                    > Dim CaseNumberFilte rBox As TextBox = New TextBox
                    >
                    > CaseNumberSortB utton.ID = "CaseNumberSort Button"
                    > CaseNumberSortB utton.Text = "Sort CaseNo"
                    > CaseNumberSortB utton.ToolTip = "Click to sort[/color]
                    the case number[color=blue]
                    >column"
                    >
                    > CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
                    > CaseNumberFilte rBox.ToolTip = "Enter case number[/color]
                    on which to filter[color=blue]
                    >records"
                    >
                    > CaseNumberHCell 1.VerticalAlign =[/color]
                    VerticalAlign.B ottom[color=blue]
                    > CaseNumberHCell 1.HorizontalAli gn =[/color]
                    HorizontalAlign .Center[color=blue]
                    > CaseNumberHCell 1.Controls.Add[/color]
                    (CaseNumberSort Button)[color=blue]
                    >
                    > CaseNumberHCell 2.VerticalAlign =[/color]
                    VerticalAlign.T op[color=blue]
                    > CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
                    > CaseNumberHCell 2.Controls.Add[/color]
                    (CaseNumberFilt erBox)[color=blue]
                    > CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
                    > CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
                    > CaseNumberHeade rTable.Controls .Add[/color]
                    (CaseNumberHRow 1)[color=blue]
                    > CaseNumberHeade rTable.Controls .Add[/color]
                    (CaseNumberHRow 2)[color=blue]
                    > CaseNumberHeade rTable.ID[/color]
                    = "CaseNumberHead erTable"[color=blue]
                    > CaseNumberHeade rTable.BorderCo lor = Color.Blue
                    > End Sub
                    >
                    >
                    >Lewis Wang
                    >
                    >This posting is provided "AS IS" with no warranties, and[/color]
                    confers no rights.[color=blue]
                    >--------------------
                    >| Content-Class: urn:content-classes:message
                    >| From: "Sue" <Sue@ojd.state. or.us>
                    >| Sender: "Sue" <Sue@ojd.state. or.us>
                    >| References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                    ><Dysu1QeUDHA.1 688@cpmsftngxa0 6.phx.gbl>
                    >| Subject: RE: Adding webcontrols.tab le to aspx - not[/color]
                    rendering[color=blue]
                    >| Date: Thu, 24 Jul 2003 11:38:45 -0700
                    >| Lines: 87
                    >| Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                    >| MIME-Version: 1.0
                    >| Content-Type: text/plain;
                    >| charset="iso-8859-1"
                    >| Content-Transfer-Encoding: 7bit
                    >| X-Newsreader: Microsoft CDO for Windows 2000
                    >| X-MimeOLE: Produced By Microsoft MimeOLE[/color]
                    V5.50.4910.0300[color=blue]
                    >| Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
                    >| Newsgroups: microsoft.publi c.dotnet.genera l
                    >| Path: cpmsftngxa06.ph x.gbl
                    >| Xref: cpmsftngxa06.ph x.gbl[/color]
                    microsoft.publi c.dotnet.genera l:102328[color=blue]
                    >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
                    >| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                    >|
                    >| >your side? If so, you may want to show me the code
                    >| snippet on your side so
                    >| >that I can test it. Thanks.
                    >|
                    >| Lewis, tried your code, but I'm working in VB and
                    >| couldn't remember half of how to get things set up for[/color]
                    C[color=blue]
                    >| (#?). I do have a similar table working just find
                    >| further up in the web page. It's not part of a[/color]
                    datagrid[color=blue]
                    >| though. Below is the relevant code for this problem.
                    >|
                    >| Protected WithEvents CaseNumberSortB utton As[/color]
                    LinkButton =[color=blue]
                    >| LinkButton
                    >| Protected WithEvents CaseNumberFilte rBox As TextBox =[/color]
                    New[color=blue]
                    >| TextBox
                    >| Protected WithEvents CaseNumberHeade rTable As Table =[/color]
                    New[color=blue]
                    >| Table
                    >| Protected WithEvents CaseNumberHRow1 As TableRow = New
                    >| TableRow
                    >| Protected WithEvents CaseNumberHRow2 As TableRow = New
                    >| TableRow
                    >| Protected WithEvents CaseNumberHCell 1 As TableCell =[/color]
                    New[color=blue]
                    >| TableCell
                    >| Protected WithEvents CaseNumberHCell 2 As TableCell =[/color]
                    New[color=blue]
                    >| TableCell
                    >|
                    >| Private Sub Page_Load(ByVal sender As System.Object,
                    >| ByVal e As System.EventArg s) Handles MyBase.Load
                    >| Call setCaseNumberHe aderTable()
                    >| End Sub
                    >|
                    >| Public Sub setCaseNumberHe aderTable()
                    >| With CaseNumberSortB utton
                    >| .ID = "CaseNumberSort Button"
                    >| .Text = "Sort CaseNo"
                    >| .ToolTip = "Click to sort the case number column"
                    >| End With
                    >| With CaseNumberFilte rBox
                    >| .ID = "CaseNumberFilt erBox"
                    >| .ToolTip = "Enter case number on which to filter
                    >| records"
                    >| End With
                    >| With Me.CaseNumberHC ell1
                    >| .VerticalAlign = VerticalAlign.B ottom
                    >| .HorizontalAlig n = HorizontalAlign .Center
                    >| .Controls.Add(C aseNumberSortBu tton)
                    >| End With
                    >| With CaseNumberHCell 2
                    >| .VerticalAlign = VerticalAlign.T op
                    >| .Text = "Filter by: <BR><HR><BR>"
                    >| .Controls.Add(C aseNumberFilter Box)
                    >| End With
                    >| With Me.CaseNumberHR ow1
                    >| .Controls.Add(C aseNumberHCell1 )
                    >| End With
                    >| With CaseNumberHRow2
                    >| .Controls.Add(C aseNumberHCell2 )
                    >| End With
                    >| With CaseNumberHeade rTable
                    >| .Controls.Add(C aseNumberHRow1)
                    >| .Controls.Add(C aseNumberHRow2)
                    >| .ID = "CaseNumberHead erTable"
                    >| .Width.Percenta ge(100)
                    >| End With
                    >| End Sub
                    >|
                    >| .aspx file:
                    >|
                    >| <asp:datagrid id=DG runat="server">
                    >| <Columns>
                    >| <asp:TemplateCo lumn SortExpression= "CaseNo">
                    >| <HeaderTemplate >
                    >| <asp:Table ID="CaseNumberH eaderTable"
                    >| Runat="Server" />
                    >| </HeaderTemplate>
                    >| ......
                    >| </asp:TemplateCol umn>
                    >| </Columns>
                    >| </asp:Datagrid>
                    >|
                    >| Any help appreciated...
                    >|
                    >| Sue
                    >|
                    >|
                    >|
                    >|
                    >|
                    >|
                    >
                    >.
                    >[/color]

                    Comment

                    • Lewis Wang [MSFT]

                      #11
                      RE: Adding webcontrols.tab le to aspx - not rendering

                      Hi Sue,

                      The Type should be the same as control's type <asp:Table
                      ID="CaseNumberH eaderTable" Runat="Server" />. Otherwise, there will be an
                      error. If FindControl menthod returns nothing, there will also be an error.
                      You can use code similar to the following to perform the cast.

                      Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object, ByVal e
                      As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
                      DataGrid1.ItemD ataBound

                      If e.Item.ItemType = ListItemType.He ader Then
                      Dim ctrl As Control =
                      e.Item.FindCont rol("CaseNumber HeaderTable")
                      If Not ctrl Is Nothing Then
                      CaseNumberHeade rTable = CType(ctrl, Table)
                      setCaseNumberHe aderTable()
                      End If
                      End If

                      End Sub

                      Please let know if it helps. Thanks.

                      Lewis

                      This posting is provided "AS IS" with no warranties, and confers no rights.


                      --------------------
                      | Content-Class: urn:content-classes:message
                      | From: "Sue" <Sue@ojd.state. or.us>
                      | Sender: "Sue" <Sue@ojd.state. or.us>
                      | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                      <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
                      <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                      <Ipx6WfqUDHA.21 52@cpmsftngxa06 .phx.gbl>
                      | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
                      | Date: Mon, 28 Jul 2003 10:03:35 -0700
                      | Lines: 204
                      | Message-ID: <333601c3552a$2 ed78710$a001280 a@phx.gbl>
                      | MIME-Version: 1.0
                      | Content-Type: text/plain;
                      | charset="iso-8859-1"
                      | Content-Transfer-Encoding: 7bit
                      | X-Newsreader: Microsoft CDO for Windows 2000
                      | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
                      | Thread-Index: AcNVKi7XO2W/Wc7XRJSgT85DFF8 sFw==
                      | Newsgroups: microsoft.publi c.dotnet.genera l
                      | Path: cpmsftngxa06.ph x.gbl
                      | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102600
                      | NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
                      | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                      |
                      | >If I misunderstood your concern, would you please
                      | provide more explanations
                      | >on your requirement? Thank you.
                      |
                      | This is exactly what I wish to do. I have tried the code
                      | below (modified for my object names) and got an invalid
                      | cast error message at the CType line. I know this is
                      | simple, I'm just not tripping onto the correct syntax
                      | <sigh>. I've tried various options for the CType without
                      | success. Any other ideas?
                      |
                      | tia,
                      | Sue
                      |
                      | >
                      | >Dim CaseNumberHeade rTable As Table
                      | >
                      | >Private Sub DataGrid1_ItemD ataBound(ByVal sender As
                      | System.Object, ByVal e
                      | >As System.Web.UI.W ebControls.Data GridItemEventAr gs)
                      | Handles
                      | >DataGrid1.Item DataBound
                      | > If e.Item.ItemType = ListItemType.He ader Then
                      | > CaseNumberHeade rTable =
                      | >CType(e.Item.F indControl("Cas eNumberHeaderTa ble"), Table)
                      | > setCaseNumberHe aderTable()
                      | > End If
                      | >
                      | > End Sub
                      | >
                      | >Private Sub setCaseNumberHe aderTable()
                      | >
                      | > Dim CaseNumberHRow1 As TableRow = New TableRow
                      | > Dim CaseNumberHRow2 As TableRow = New TableRow
                      | > Dim CaseNumberHCell 1 As TableCell = New TableCell
                      | > Dim CaseNumberHCell 2 As TableCell = New TableCell
                      | >
                      | > Dim CaseNumberSortB utton As LinkButton = New
                      | LinkButton
                      | > Dim CaseNumberFilte rBox As TextBox = New TextBox
                      | >
                      | > CaseNumberSortB utton.ID = "CaseNumberSort Button"
                      | > CaseNumberSortB utton.Text = "Sort CaseNo"
                      | > CaseNumberSortB utton.ToolTip = "Click to sort
                      | the case number
                      | >column"
                      | >
                      | > CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
                      | > CaseNumberFilte rBox.ToolTip = "Enter case number
                      | on which to filter
                      | >records"
                      | >
                      | > CaseNumberHCell 1.VerticalAlign =
                      | VerticalAlign.B ottom
                      | > CaseNumberHCell 1.HorizontalAli gn =
                      | HorizontalAlign .Center
                      | > CaseNumberHCell 1.Controls.Add
                      | (CaseNumberSort Button)
                      | >
                      | > CaseNumberHCell 2.VerticalAlign =
                      | VerticalAlign.T op
                      | > CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
                      | > CaseNumberHCell 2.Controls.Add
                      | (CaseNumberFilt erBox)
                      | > CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
                      | > CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
                      | > CaseNumberHeade rTable.Controls .Add
                      | (CaseNumberHRow 1)
                      | > CaseNumberHeade rTable.Controls .Add
                      | (CaseNumberHRow 2)
                      | > CaseNumberHeade rTable.ID
                      | = "CaseNumberHead erTable"
                      | > CaseNumberHeade rTable.BorderCo lor = Color.Blue
                      | > End Sub
                      | >
                      | >
                      | >Lewis Wang
                      | >
                      | >This posting is provided "AS IS" with no warranties, and
                      | confers no rights.
                      | >--------------------
                      | >| Content-Class: urn:content-classes:message
                      | >| From: "Sue" <Sue@ojd.state. or.us>
                      | >| Sender: "Sue" <Sue@ojd.state. or.us>
                      | >| References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                      | ><Dysu1QeUDHA.1 688@cpmsftngxa0 6.phx.gbl>
                      | >| Subject: RE: Adding webcontrols.tab le to aspx - not
                      | rendering
                      | >| Date: Thu, 24 Jul 2003 11:38:45 -0700
                      | >| Lines: 87
                      | >| Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                      | >| MIME-Version: 1.0
                      | >| Content-Type: text/plain;
                      | >| charset="iso-8859-1"
                      | >| Content-Transfer-Encoding: 7bit
                      | >| X-Newsreader: Microsoft CDO for Windows 2000
                      | >| X-MimeOLE: Produced By Microsoft MimeOLE
                      | V5.50.4910.0300
                      | >| Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
                      | >| Newsgroups: microsoft.publi c.dotnet.genera l
                      | >| Path: cpmsftngxa06.ph x.gbl
                      | >| Xref: cpmsftngxa06.ph x.gbl
                      | microsoft.publi c.dotnet.genera l:102328
                      | >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
                      | >| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                      | >|
                      | >| >your side? If so, you may want to show me the code
                      | >| snippet on your side so
                      | >| >that I can test it. Thanks.
                      | >|
                      | >| Lewis, tried your code, but I'm working in VB and
                      | >| couldn't remember half of how to get things set up for
                      | C
                      | >| (#?). I do have a similar table working just find
                      | >| further up in the web page. It's not part of a
                      | datagrid
                      | >| though. Below is the relevant code for this problem.
                      | >|
                      | >| Protected WithEvents CaseNumberSortB utton As
                      | LinkButton =
                      | >| LinkButton
                      | >| Protected WithEvents CaseNumberFilte rBox As TextBox =
                      | New
                      | >| TextBox
                      | >| Protected WithEvents CaseNumberHeade rTable As Table =
                      | New
                      | >| Table
                      | >| Protected WithEvents CaseNumberHRow1 As TableRow = New
                      | >| TableRow
                      | >| Protected WithEvents CaseNumberHRow2 As TableRow = New
                      | >| TableRow
                      | >| Protected WithEvents CaseNumberHCell 1 As TableCell =
                      | New
                      | >| TableCell
                      | >| Protected WithEvents CaseNumberHCell 2 As TableCell =
                      | New
                      | >| TableCell
                      | >|
                      | >| Private Sub Page_Load(ByVal sender As System.Object,
                      | >| ByVal e As System.EventArg s) Handles MyBase.Load
                      | >| Call setCaseNumberHe aderTable()
                      | >| End Sub
                      | >|
                      | >| Public Sub setCaseNumberHe aderTable()
                      | >| With CaseNumberSortB utton
                      | >| .ID = "CaseNumberSort Button"
                      | >| .Text = "Sort CaseNo"
                      | >| .ToolTip = "Click to sort the case number column"
                      | >| End With
                      | >| With CaseNumberFilte rBox
                      | >| .ID = "CaseNumberFilt erBox"
                      | >| .ToolTip = "Enter case number on which to filter
                      | >| records"
                      | >| End With
                      | >| With Me.CaseNumberHC ell1
                      | >| .VerticalAlign = VerticalAlign.B ottom
                      | >| .HorizontalAlig n = HorizontalAlign .Center
                      | >| .Controls.Add(C aseNumberSortBu tton)
                      | >| End With
                      | >| With CaseNumberHCell 2
                      | >| .VerticalAlign = VerticalAlign.T op
                      | >| .Text = "Filter by: <BR><HR><BR>"
                      | >| .Controls.Add(C aseNumberFilter Box)
                      | >| End With
                      | >| With Me.CaseNumberHR ow1
                      | >| .Controls.Add(C aseNumberHCell1 )
                      | >| End With
                      | >| With CaseNumberHRow2
                      | >| .Controls.Add(C aseNumberHCell2 )
                      | >| End With
                      | >| With CaseNumberHeade rTable
                      | >| .Controls.Add(C aseNumberHRow1)
                      | >| .Controls.Add(C aseNumberHRow2)
                      | >| .ID = "CaseNumberHead erTable"
                      | >| .Width.Percenta ge(100)
                      | >| End With
                      | >| End Sub
                      | >|
                      | >| .aspx file:
                      | >|
                      | >| <asp:datagrid id=DG runat="server">
                      | >| <Columns>
                      | >| <asp:TemplateCo lumn SortExpression= "CaseNo">
                      | >| <HeaderTemplate >
                      | >| <asp:Table ID="CaseNumberH eaderTable"
                      | >| Runat="Server" />
                      | >| </HeaderTemplate>
                      | >| ......
                      | >| </asp:TemplateCol umn>
                      | >| </Columns>
                      | >| </asp:Datagrid>
                      | >|
                      | >| Any help appreciated...
                      | >|
                      | >| Sue
                      | >|
                      | >|
                      | >|
                      | >|
                      | >|
                      | >|
                      | >
                      | >.
                      | >
                      |

                      Comment

                      • Lewis Wang [MSFT]

                        #12
                        RE: Adding webcontrols.tab le to aspx - not rendering

                        Hi Sue,

                        The Type should be the same as control's type <asp:Table
                        ID="CaseNumberH eaderTable" Runat="Server" />. Otherwise, there will be an
                        error. If FindControl menthod returns nothing, there will also be an error.
                        You can use code similar to the following to perform the cast.

                        Private Sub DataGrid1_ItemD ataBound(ByVal sender As System.Object, ByVal e
                        As System.Web.UI.W ebControls.Data GridItemEventAr gs) Handles
                        DataGrid1.ItemD ataBound

                        If e.Item.ItemType = ListItemType.He ader Then
                        Dim ctrl As Control =
                        e.Item.FindCont rol("CaseNumber HeaderTable")
                        If Not ctrl Is Nothing Then
                        CaseNumberHeade rTable = CType(ctrl, Table)
                        setCaseNumberHe aderTable()
                        End If
                        End If

                        End Sub

                        Please let know if it helps. Thanks.

                        Lewis

                        This posting is provided "AS IS" with no warranties, and confers no rights.


                        --------------------
                        | Content-Class: urn:content-classes:message
                        | From: "Sue" <Sue@ojd.state. or.us>
                        | Sender: "Sue" <Sue@ojd.state. or.us>
                        | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                        <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
                        <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                        <Ipx6WfqUDHA.21 52@cpmsftngxa06 .phx.gbl>
                        | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
                        | Date: Mon, 28 Jul 2003 10:03:35 -0700
                        | Lines: 204
                        | Message-ID: <333601c3552a$2 ed78710$a001280 a@phx.gbl>
                        | MIME-Version: 1.0
                        | Content-Type: text/plain;
                        | charset="iso-8859-1"
                        | Content-Transfer-Encoding: 7bit
                        | X-Newsreader: Microsoft CDO for Windows 2000
                        | X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
                        | Thread-Index: AcNVKi7XO2W/Wc7XRJSgT85DFF8 sFw==
                        | Newsgroups: microsoft.publi c.dotnet.genera l
                        | Path: cpmsftngxa06.ph x.gbl
                        | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102600
                        | NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
                        | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                        |
                        | >If I misunderstood your concern, would you please
                        | provide more explanations
                        | >on your requirement? Thank you.
                        |
                        | This is exactly what I wish to do. I have tried the code
                        | below (modified for my object names) and got an invalid
                        | cast error message at the CType line. I know this is
                        | simple, I'm just not tripping onto the correct syntax
                        | <sigh>. I've tried various options for the CType without
                        | success. Any other ideas?
                        |
                        | tia,
                        | Sue
                        |
                        | >
                        | >Dim CaseNumberHeade rTable As Table
                        | >
                        | >Private Sub DataGrid1_ItemD ataBound(ByVal sender As
                        | System.Object, ByVal e
                        | >As System.Web.UI.W ebControls.Data GridItemEventAr gs)
                        | Handles
                        | >DataGrid1.Item DataBound
                        | > If e.Item.ItemType = ListItemType.He ader Then
                        | > CaseNumberHeade rTable =
                        | >CType(e.Item.F indControl("Cas eNumberHeaderTa ble"), Table)
                        | > setCaseNumberHe aderTable()
                        | > End If
                        | >
                        | > End Sub
                        | >
                        | >Private Sub setCaseNumberHe aderTable()
                        | >
                        | > Dim CaseNumberHRow1 As TableRow = New TableRow
                        | > Dim CaseNumberHRow2 As TableRow = New TableRow
                        | > Dim CaseNumberHCell 1 As TableCell = New TableCell
                        | > Dim CaseNumberHCell 2 As TableCell = New TableCell
                        | >
                        | > Dim CaseNumberSortB utton As LinkButton = New
                        | LinkButton
                        | > Dim CaseNumberFilte rBox As TextBox = New TextBox
                        | >
                        | > CaseNumberSortB utton.ID = "CaseNumberSort Button"
                        | > CaseNumberSortB utton.Text = "Sort CaseNo"
                        | > CaseNumberSortB utton.ToolTip = "Click to sort
                        | the case number
                        | >column"
                        | >
                        | > CaseNumberFilte rBox.ID = "CaseNumberFilt erBox"
                        | > CaseNumberFilte rBox.ToolTip = "Enter case number
                        | on which to filter
                        | >records"
                        | >
                        | > CaseNumberHCell 1.VerticalAlign =
                        | VerticalAlign.B ottom
                        | > CaseNumberHCell 1.HorizontalAli gn =
                        | HorizontalAlign .Center
                        | > CaseNumberHCell 1.Controls.Add
                        | (CaseNumberSort Button)
                        | >
                        | > CaseNumberHCell 2.VerticalAlign =
                        | VerticalAlign.T op
                        | > CaseNumberHCell 2.Text = "Filter by: <BR><HR><BR>"
                        | > CaseNumberHCell 2.Controls.Add
                        | (CaseNumberFilt erBox)
                        | > CaseNumberHRow1 .Controls.Add(C aseNumberHCell1 )
                        | > CaseNumberHRow2 .Controls.Add(C aseNumberHCell2 )
                        | > CaseNumberHeade rTable.Controls .Add
                        | (CaseNumberHRow 1)
                        | > CaseNumberHeade rTable.Controls .Add
                        | (CaseNumberHRow 2)
                        | > CaseNumberHeade rTable.ID
                        | = "CaseNumberHead erTable"
                        | > CaseNumberHeade rTable.BorderCo lor = Color.Blue
                        | > End Sub
                        | >
                        | >
                        | >Lewis Wang
                        | >
                        | >This posting is provided "AS IS" with no warranties, and
                        | confers no rights.
                        | >--------------------
                        | >| Content-Class: urn:content-classes:message
                        | >| From: "Sue" <Sue@ojd.state. or.us>
                        | >| Sender: "Sue" <Sue@ojd.state. or.us>
                        | >| References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                        | ><Dysu1QeUDHA.1 688@cpmsftngxa0 6.phx.gbl>
                        | >| Subject: RE: Adding webcontrols.tab le to aspx - not
                        | rendering
                        | >| Date: Thu, 24 Jul 2003 11:38:45 -0700
                        | >| Lines: 87
                        | >| Message-ID: <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                        | >| MIME-Version: 1.0
                        | >| Content-Type: text/plain;
                        | >| charset="iso-8859-1"
                        | >| Content-Transfer-Encoding: 7bit
                        | >| X-Newsreader: Microsoft CDO for Windows 2000
                        | >| X-MimeOLE: Produced By Microsoft MimeOLE
                        | V5.50.4910.0300
                        | >| Thread-Index: AcNSEtCmGhmPnX8 ZQxeVikG/sDAnmg==
                        | >| Newsgroups: microsoft.publi c.dotnet.genera l
                        | >| Path: cpmsftngxa06.ph x.gbl
                        | >| Xref: cpmsftngxa06.ph x.gbl
                        | microsoft.publi c.dotnet.genera l:102328
                        | >| NNTP-Posting-Host: TK2MSFTNGXA12 10.40.1.164
                        | >| X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                        | >|
                        | >| >your side? If so, you may want to show me the code
                        | >| snippet on your side so
                        | >| >that I can test it. Thanks.
                        | >|
                        | >| Lewis, tried your code, but I'm working in VB and
                        | >| couldn't remember half of how to get things set up for
                        | C
                        | >| (#?). I do have a similar table working just find
                        | >| further up in the web page. It's not part of a
                        | datagrid
                        | >| though. Below is the relevant code for this problem.
                        | >|
                        | >| Protected WithEvents CaseNumberSortB utton As
                        | LinkButton =
                        | >| LinkButton
                        | >| Protected WithEvents CaseNumberFilte rBox As TextBox =
                        | New
                        | >| TextBox
                        | >| Protected WithEvents CaseNumberHeade rTable As Table =
                        | New
                        | >| Table
                        | >| Protected WithEvents CaseNumberHRow1 As TableRow = New
                        | >| TableRow
                        | >| Protected WithEvents CaseNumberHRow2 As TableRow = New
                        | >| TableRow
                        | >| Protected WithEvents CaseNumberHCell 1 As TableCell =
                        | New
                        | >| TableCell
                        | >| Protected WithEvents CaseNumberHCell 2 As TableCell =
                        | New
                        | >| TableCell
                        | >|
                        | >| Private Sub Page_Load(ByVal sender As System.Object,
                        | >| ByVal e As System.EventArg s) Handles MyBase.Load
                        | >| Call setCaseNumberHe aderTable()
                        | >| End Sub
                        | >|
                        | >| Public Sub setCaseNumberHe aderTable()
                        | >| With CaseNumberSortB utton
                        | >| .ID = "CaseNumberSort Button"
                        | >| .Text = "Sort CaseNo"
                        | >| .ToolTip = "Click to sort the case number column"
                        | >| End With
                        | >| With CaseNumberFilte rBox
                        | >| .ID = "CaseNumberFilt erBox"
                        | >| .ToolTip = "Enter case number on which to filter
                        | >| records"
                        | >| End With
                        | >| With Me.CaseNumberHC ell1
                        | >| .VerticalAlign = VerticalAlign.B ottom
                        | >| .HorizontalAlig n = HorizontalAlign .Center
                        | >| .Controls.Add(C aseNumberSortBu tton)
                        | >| End With
                        | >| With CaseNumberHCell 2
                        | >| .VerticalAlign = VerticalAlign.T op
                        | >| .Text = "Filter by: <BR><HR><BR>"
                        | >| .Controls.Add(C aseNumberFilter Box)
                        | >| End With
                        | >| With Me.CaseNumberHR ow1
                        | >| .Controls.Add(C aseNumberHCell1 )
                        | >| End With
                        | >| With CaseNumberHRow2
                        | >| .Controls.Add(C aseNumberHCell2 )
                        | >| End With
                        | >| With CaseNumberHeade rTable
                        | >| .Controls.Add(C aseNumberHRow1)
                        | >| .Controls.Add(C aseNumberHRow2)
                        | >| .ID = "CaseNumberHead erTable"
                        | >| .Width.Percenta ge(100)
                        | >| End With
                        | >| End Sub
                        | >|
                        | >| .aspx file:
                        | >|
                        | >| <asp:datagrid id=DG runat="server">
                        | >| <Columns>
                        | >| <asp:TemplateCo lumn SortExpression= "CaseNo">
                        | >| <HeaderTemplate >
                        | >| <asp:Table ID="CaseNumberH eaderTable"
                        | >| Runat="Server" />
                        | >| </HeaderTemplate>
                        | >| ......
                        | >| </asp:TemplateCol umn>
                        | >| </Columns>
                        | >| </asp:Datagrid>
                        | >|
                        | >| Any help appreciated...
                        | >|
                        | >| Sue
                        | >|
                        | >|
                        | >|
                        | >|
                        | >|
                        | >|
                        | >
                        | >.
                        | >
                        |

                        Comment

                        • Lewis Wang [MSFT]

                          #13
                          RE: Adding webcontrols.tab le to aspx - not rendering

                          Hi Sue,

                          I am glad to hear it. Thanks very much for participating the community.

                          Lewis

                          --------------------
                          | Content-Class: urn:content-classes:message
                          | From: "Sue" <Sue@ojd.state. or.us>
                          | Sender: "Sue" <Sue@ojd.state. or.us>
                          | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                          <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
                          <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                          <Ipx6WfqUDHA.21 52@cpmsftngxa06 .phx.gbl>
                          <333601c3552a$2 ed78710$a001280 a@phx.gbl>
                          <CF4wWBbVDHA.20 92@cpmsftngxa06 .phx.gbl>
                          | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
                          | Date: Tue, 29 Jul 2003 08:41:29 -0700
                          | Lines: 12
                          | Message-ID: <008801c355e7$e 0f08010$a301280 a@phx.gbl>
                          | MIME-Version: 1.0
                          | Content-Type: text/plain;
                          | charset="iso-8859-1"
                          | Content-Transfer-Encoding: 7bit
                          | X-Newsreader: Microsoft CDO for Windows 2000
                          | X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
                          | Thread-Index: AcNV5+DwpsTgGSI tQI60DEU5KS6ZWw ==
                          | Newsgroups: microsoft.publi c.dotnet.genera l
                          | Path: cpmsftngxa06.ph x.gbl
                          | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102714
                          | NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
                          | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                          |
                          | Aha...in my HTML on the .aspx page, I had used
                          | <table...>. Once I changed it to <asp:table> things
                          | started working. Thanks for the help with this - I knew
                          | it was something simple that I just wasn't seeing. Live
                          | and learn.
                          |
                          | Sue
                          |
                          | >The Type should be the same as control's type <asp:Table
                          | >ID="CaseNumber HeaderTable" Runat="Server" />.
                          |
                          |
                          |

                          Comment

                          • Lewis Wang [MSFT]

                            #14
                            RE: Adding webcontrols.tab le to aspx - not rendering

                            Hi Sue,

                            I am glad to hear it. Thanks very much for participating the community.

                            Lewis

                            --------------------
                            | Content-Class: urn:content-classes:message
                            | From: "Sue" <Sue@ojd.state. or.us>
                            | Sender: "Sue" <Sue@ojd.state. or.us>
                            | References: <#T5wrqUUDHA.10 52@TK2MSFTNGP09 .phx.gbl>
                            <Dysu1QeUDHA.16 88@cpmsftngxa06 .phx.gbl>
                            <018b01c35212$d 0a689d0$a401280 a@phx.gbl>
                            <Ipx6WfqUDHA.21 52@cpmsftngxa06 .phx.gbl>
                            <333601c3552a$2 ed78710$a001280 a@phx.gbl>
                            <CF4wWBbVDHA.20 92@cpmsftngxa06 .phx.gbl>
                            | Subject: RE: Adding webcontrols.tab le to aspx - not rendering
                            | Date: Tue, 29 Jul 2003 08:41:29 -0700
                            | Lines: 12
                            | Message-ID: <008801c355e7$e 0f08010$a301280 a@phx.gbl>
                            | MIME-Version: 1.0
                            | Content-Type: text/plain;
                            | charset="iso-8859-1"
                            | Content-Transfer-Encoding: 7bit
                            | X-Newsreader: Microsoft CDO for Windows 2000
                            | X-MIMEOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
                            | Thread-Index: AcNV5+DwpsTgGSI tQI60DEU5KS6ZWw ==
                            | Newsgroups: microsoft.publi c.dotnet.genera l
                            | Path: cpmsftngxa06.ph x.gbl
                            | Xref: cpmsftngxa06.ph x.gbl microsoft.publi c.dotnet.genera l:102714
                            | NNTP-Posting-Host: TK2MSFTNGXA11 10.40.1.163
                            | X-Tomcat-NG: microsoft.publi c.dotnet.genera l
                            |
                            | Aha...in my HTML on the .aspx page, I had used
                            | <table...>. Once I changed it to <asp:table> things
                            | started working. Thanks for the help with this - I knew
                            | it was something simple that I just wasn't seeing. Live
                            | and learn.
                            |
                            | Sue
                            |
                            | >The Type should be the same as control's type <asp:Table
                            | >ID="CaseNumber HeaderTable" Runat="Server" />.
                            |
                            |
                            |

                            Comment

                            Working...