Dynamic Controls in ASP.NET

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bhavin

    Dynamic Controls in ASP.NET

    How can I capture user entered values from dynamically created controls in
    ASP.NET ?

    Thanks,
  • Cor Ligthert

    #2
    Re: Dynamic Controls in ASP.NET

    Bhavin,

    What program language are you using, the way you do it can difference
    slightly in the languages.

    Therefore in my opinion the language newsgroups are better for this
    question.

    microsoft.publi c.dotnet.langua ges.vb csharp vc
    microsoft.publi c.dotnet.langua ges.jsharp

    Cor

    "Bhavin" <Bhavin@discuss ions.microsoft. com> schreef in bericht
    news:B774079D-6012-48FD-8F45-6822D550A4D1@mi crosoft.com...[color=blue]
    > How can I capture user entered values from dynamically created controls in
    > ASP.NET ?
    >
    > Thanks,[/color]


    Comment

    • Cor Ligthert

      #3
      Re: Dynamic Controls in ASP.NET

      Bhavin,

      I forgot the general answer is add a handler and catch that.

      Cor

      "Bhavin" <Bhavin@discuss ions.microsoft. com>
      ...[color=blue]
      > How can I capture user entered values from dynamically created controls in
      > ASP.NET ?
      >
      > Thanks,[/color]


      Comment

      • Cor Ligthert

        #4
        Re: Dynamic Controls in ASP.NET

        Bhavin,

        I see that you leave the thread, please stay in the original thread, than I
        had not written the two previous messages, which are overcomplete now.

        Cor


        Comment

        • Bhavin

          #5
          Re: Dynamic Controls in ASP.NET

          Thanks Cor!

          Exactly that is a problem. Once all dynamic empty textboxes got created I
          entered values in them. Now I want to capture those values using dynamic IDs
          of textboxes but those IDs no longer available after page_load event. I would
          like to capture all values from textboxes to INSERT date in SQL table.

          I will post this question to C# language section.

          reply me if you can.





          "Cor Ligthert" wrote:
          [color=blue]
          > Bhavin,
          >
          > I see that you leave the thread, please stay in the original thread, than I
          > had not written the two previous messages, which are overcomplete now.
          >
          > Cor
          >
          >
          >[/color]

          Comment

          • Cor Ligthert

            #6
            Re: Dynamic Controls in ASP.NET

            Bhavin,

            I have here a complete sample as an answer using VBNet, I made it once, it
            is to much work for me to translate it now in C# however maybe you can read
            it, the differences are not that much.

            \\\needs a panel on a webform
            Private Sub Page_Load(ByVal sender As System.Object, _
            ByVal e As System.EventArg s) Handles MyBase.Load
            Dim mybutton(31) As Button
            Dim i As Integer
            For i = 0 To New Date().DaysInMo nth _
            (New Date().Year, New Date().Month) - 1
            mybutton(i) = New Button
            mybutton(i).Bac kColor = Drawing.Color.W hite
            mybutton(i).Tex t = (i + 1).ToString
            mybutton(i).Wid th = New Unit(30)
            Me.Panel1.Contr ols.Add(mybutto n(i))
            AddHandler mybutton(i).Cli ck, AddressOf mybutton_Click
            If (i + 1) Mod 5 = 0 Then
            Me.Panel1.Contr ols.Add(New LiteralControl( "<BR>"))
            End If
            Next
            End Sub
            Private Sub mybutton_Click _
            (ByVal sender As Object, ByVal e As System.EventArg s)
            Dim mylabel As New Label
            Me.Panel1.Contr ols.Add(New LiteralControl( "<BR><BR>") )
            Me.Panel1.Contr ols.Add(mylabel )
            mylabel.Text = "The day is: " & DirectCast(send er, Button).Text
            End Sub
            ///
            I hope this helps?

            Cor


            "Bhavin" <Bhavin@discuss ions.microsoft. com>

            [color=blue]
            > Thanks Cor!
            >
            > Exactly that is a problem. Once all dynamic empty textboxes got created I
            > entered values in them. Now I want to capture those values using dynamic
            > IDs
            > of textboxes but those IDs no longer available after page_load event. I
            > would
            > like to capture all values from textboxes to INSERT date in SQL table.
            >
            > I will post this question to C# language section.
            >
            > reply me if you can.
            >
            >
            >
            >
            >
            > "Cor Ligthert" wrote:
            >[color=green]
            >> Bhavin,
            >>
            >> I see that you leave the thread, please stay in the original thread, than
            >> I
            >> had not written the two previous messages, which are overcomplete now.
            >>
            >> Cor
            >>
            >>
            >>[/color][/color]


            Comment

            Working...