Hi Ashish,
>From what I can tell, you left out one part: the inputBox's ID needs
a value with which you can then reference the control.
Here's part of some similar code I wrote recently:
Sub Page_Load(sender As System.Object, e As System.EventArgs)
Dim viewGraph as Boolean
Dim AddGraph As New CheckBox()
AddGraph.Id= "AddGraph"
AddGraph.Text = "Add a Graphics Task To Your Request"
AddHandler AddGraph.CheckedChanged, AddressOf _
chkDirection_CheckedChanged
AddGraph.AutoPostBack = True
AddGraph.Visible = ViewGraph
Bullseye.Controls.Add(AddGraph)'bullseye is a placeholder control
End Sub
--- In [EMAIL PROTECTED], "Ashish Sethi"
<[EMAIL PROTECTED]> wrote:
> Hi all,
>
> I have created text box server controls dynamically on my aspx
page but I do
> not know how to access them. Some of my code is as:
>
> Dim c5 As New TableCell
> Dim InputBoxAmt As WebControl
> InputBoxAmt = New WebControl
(HtmlTextWriterTag.Input)
> InputBoxAmt.Attributes.Add("type", "text")
> InputBoxAmt.Attributes.Add("ID", "txtAmt" & ctr)
> InputBoxAmt.Attributes.Add("Value",
> FormatNumber(dar.Item("ExpectedAmt"), 2))
> InputBoxAmt.Width = InputBoxAmt.Width.Parse("100")
> c5.HorizontalAlign = HorizontalAlign.Center
> c5.Controls.Add(InputBoxAmt)
>
> This code adds the text box on the page with all the properties
etc. ctr in
> the above code is the counter that gives each textbox a unique id.
So my
> text box will have ids as txtAmt1, txtAmt2 etc. The question is
how do I
> read the values or change values in this text box programmatically.
>
> Your help is much appreciated,
> Ash
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/