How to FindControl of HTML

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sayona76
    New Member
    • Nov 2008
    • 5

    How to FindControl of HTML

    hello,

    i am trying to find control (textbox) of html which is placed inside the text of lable of asp.net.

    here is the code which i used..
    Code:
    protected void Page_Load(object sender, EventArgs e)
    {
       StreamReader reader = new StreamReader(@"d:\WebSite1\HTMLPage.htm");
        String line = reader.ReadToEnd();
        Label1.Text = line;
    }
    protected void Button1_Click(object sender, EventArgs e)
     {
         string control;
          foreach (Control c in form1.Controls)
          {
              control = c.ID;
               if (control != null)
                {
                  // ti is html textbox
                   HtmlGenericControl iframe = (HtmlGenericControl)c.FindControl("t1");
                   control = iframe.InnerText;
                }
            }
    }
    anyone know how can i find the value of the textbox of this html file using asp.net c#

    Thanks
    Last edited by tlhintoq; Jun 4 '09, 05:07 PM. Reason: [CODE] ... your code here ... [/CODE] tags added
  • sayona76
    New Member
    • Nov 2008
    • 5

    #2
    anyone know how can i find html control from html file using asp.net

    please help anyone.

    Thank You

    Comment

    • r035198x
      MVP
      • Sep 2006
      • 13225

      #3
      Surely you didn't say that your textbox is placed inside the text of a label?

      Comment

      • Plater
        Recognized Expert Expert
        • Apr 2007
        • 7872

        #4
        Ok I see, you're cheating and loading the html of another page into a child control of your actual page.
        None of those controls will be registered with the server side. You might be able to use javascript to find the textbox you want.

        Comment

        • sayona76
          New Member
          • Nov 2008
          • 5

          #5
          hello Plater
          how can do this.

          if you have any link/sample code for further studies for me.

          i am waiting your reply.

          Thank You

          Comment

          • Plater
            Recognized Expert Expert
            • Apr 2007
            • 7872

            #6
            you could try document.getEle mentById(id) if you know the id of the textbox

            Comment

            Working...