|
-
Apr 15th, 2004, 10:33 AM
#1
Thread Starter
Junior Member
Checkbox runat="server"
I have an ascx control has of DataGrid. My problem is that when I use the render control on the other page it has the error as follows: Checkbox must be placed inside a form tag with runat="server"
The checkbox was created dynamically in VB not in the HTML side. I suspected that this was the cause of the problem. How can I set the checkbox to has attribites <runat="server">?
I have tried the ff code but still it doesn't work:
Dim chk As CheckBox
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
chk = New CheckBox()
htmlWrite.Write("<script>runat=server</script>")
chk.Attributes.AddAttributes(htmlWrite)
thanx
-
Apr 15th, 2004, 01:37 PM
#2
Frenzied Member
have you tried something like
Code:
Page.Controls.Add(chk)
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Apr 16th, 2004, 03:34 AM
#3
Thread Starter
Junior Member
I tried. Server Error occured "A control cannot modify its parents' control collections.
-
Apr 16th, 2004, 09:55 PM
#4
I wonder how many charact
If you're creating your checkbox in the VB code-behind, it is running at the server.
You need to clarify to us where the checkbox is being created. I think you mean its being created inside the datagrid, in which case, the datagrid handles that all for you. You just need to find it on postback by referencing the datalistitem, and using the FindControl method.
-
Apr 19th, 2004, 03:02 AM
#5
Thread Starter
Junior Member
Yes, ur right the checkbox was created inside the datagrid on the user control
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|