Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dynamic web controlsDynamic web controls
Previous
 
Next
New Post
5/26/2009 4:49 AM
 

Hi,

in my aspx page I have somting like that:

<asp:Content ID="Content1" ContentPlaceHolderID="Body" Runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" ChildrenAsTriggers="true" UpdateMode="Conditional" runat="server" >
        <ContentTemplate>
            <asp:Panel ID="Panel1" runat="server">

<asp:Table ID="PO_Tags" Width="90%" BorderWidth="1" HorizontalAlign="Center" 
                CellPadding ="2" CellSpacing ="1" visible="false" runat="server">
                <asp:TableHeaderRow>
                    <asp:TableHeaderCell BackColor="AliceBlue" >Tag Name<br /><br /></asp:TableHeaderCell>
                    <asp:TableHeaderCell BackColor="AliceBlue" >Association Type<br /><br /></asp:TableHeaderCell>
                    <asp:TableHeaderCell BackColor="AliceBlue" >Tag Description<br /><br /></asp:TableHeaderCell>
                    <asp:TableHeaderCell BackColor="AliceBlue" >Tag Value<br /><br /></asp:TableHeaderCell>
                </asp:TableHeaderRow>
            </asp:Table>
           
            <br />
            <asp:Button ID="Submit" Text="Submit" OnClick="Submit_Click" Visible="false" runat="server" />
           
            </asp:Panel>
        </ContentTemplate>
     </asp:UpdatePanel> 
</asp:Content>
 

from c# code I'm building my table rows dynamicly:

while (rdr.Read())
                    {
                        trRow = new TableRow();
                       
                        tcCell = new TableCell();
                        tcCell.Text = rdr["Label"].ToString();
                        trRow.Cells.Add(tcCell);

                        tcCell = new TableCell();
                        switch (rdr["ControlType"].ToString())
                        {
                            case "Text":
                            case "Integer":
                            case "Real":
                                TextBox ctrl1 = new TextBox();
                                ctrl1.ID = String.format("tagCtrl{0}" ,countTagsControls);
                                ctrl1.Text = "Test";
                                tcCell.Controls.Add(ctrl1);
                                //this.UpdatePanel1.ContentTemplateContainer.Controls.Add(ctrl1);
                                break;

                              .......

                     }

           trRow.Cells.Add(tcCell);
           PO_Tags.Rows.Add(trRow);

Then I'm trying to get the values of those controls:

TextBox txtCtl = (TextBox)UpdatePanel1.FindControl(String.format("tagCtrl{0}", i));
                    switch (rdr["ControlType"].ToString())
                    {
                        case "Text":
                            string v1 = txtCtl.Text.ToString();
                            break;

But it's not working!!
What I'm missing?!

Thanks in advance.

 
New Post
5/26/2009 10:00 AM
 

Do you get any errors? What happens when it runs? If it fails silently, then your case may never be occurring - add in a default with some output so you can see if it goes there.

 
Previous
 
Next
HomeHomeArchived Discus...Archived Discus...Developing Under Previous Versions of .NETDeveloping Under Previous Versions of .NETASP.Net 2.0ASP.Net 2.0Dynamic web controlsDynamic web controls


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out