By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,786 Members | 1,131 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,786 IT Pros & Developers. It's quick & easy.

Resonse.Write an asp:Checkbox

P: n/a
....hi everyone,
....i posted this allready, but my newsreader doesn't display it to me - so
i'm sorry if it's posted twice...

hi again,

sorry for not clearly writing what i really need :)

if i have the following in the aspx file

<body>
...
<asp:CheckBox ID="chkMe_One" runat=server/><br />
<% void_write_checkbox(); %>
....
</body>

and in the aspx.cs file

public void_write_checkbox()
{
Response.Write("<asp:CheckBox ID=\"chkMe_Two\" runat=server/>");
}

the second checkbox is not appearing.

the problem is, i need to put it onto the page via response.write()

can anybody help me please?

big thanx

mike
Mar 6 '07 #1
Share this Question
Share on Google+
4 Replies


P: n/a
You can response.write a normal checkbox;

response.write ("<input type=\"checkbox\" name=\"chkMe_One\">");

Then use Request.Form or Request.Querystring to read its value.

"Mike Haberfellner" <un******@gmx.atwrote in message
news:b7***************************@news.inode.at.. .
...hi everyone,
...i posted this allready, but my newsreader doesn't display it to me - so
i'm sorry if it's posted twice...

hi again,

sorry for not clearly writing what i really need :)

if i have the following in the aspx file

<body>
...
<asp:CheckBox ID="chkMe_One" runat=server/><br />
<% void_write_checkbox(); %>
...
</body>

and in the aspx.cs file

public void_write_checkbox()
{
Response.Write("<asp:CheckBox ID=\"chkMe_Two\" runat=server/>");
}

the second checkbox is not appearing.

the problem is, i need to put it onto the page via response.write()

can anybody help me please?

big thanx

mike

Mar 6 '07 #2

P: n/a
but the problem with that is, that i cant access the "normal checkbox" by

foreach (Control locCtrl in this.Controls)...

or by

findcontrol("chkMe_One");

i need to go through all checkboxes and check their checked-state and name

thanx

mike

"Aidy" <ai**@noemail.xxxa.comschrieb im Newsbeitrag
news:za******************************@bt.com...
You can response.write a normal checkbox;

response.write ("<input type=\"checkbox\" name=\"chkMe_One\">");

Then use Request.Form or Request.Querystring to read its value.

"Mike Haberfellner" <un******@gmx.atwrote in message
news:b7***************************@news.inode.at.. .
>...hi everyone,
...i posted this allready, but my newsreader doesn't display it to me -
so i'm sorry if it's posted twice...

hi again,

sorry for not clearly writing what i really need :)

if i have the following in the aspx file

<body>
...
<asp:CheckBox ID="chkMe_One" runat=server/><br />
<% void_write_checkbox(); %>
...
</body>

and in the aspx.cs file

public void_write_checkbox()
{
Response.Write("<asp:CheckBox ID=\"chkMe_Two\" runat=server/>");
}

the second checkbox is not appearing.

the problem is, i need to put it onto the page via response.write()

can anybody help me please?

big thanx

mike


Mar 6 '07 #3

P: n/a
You are writting a server control on the client side that's why the control
does not appear.
What you could do is put a PlaceHolder <asp:PlaceHolder ID="myPlaceHolder"
runar="server" /control where you want to display the dynamic checkbox
then on load do something like that:
CheckBox myDynamicCheckBox = new CheckBox();
myDynamicCheckBox.ID = "myCheckBoxId";
myPlaceHolder.Controls.add(myDynamicCheckBox);
HTH

Kostas Pantos
but the problem with that is, that i cant access the "normal checkbox"
by

foreach (Control locCtrl in this.Controls)...

or by

findcontrol("chkMe_One");

i need to go through all checkboxes and check their checked-state and
name

thanx

mike

"Aidy" <ai**@noemail.xxxa.comschrieb im Newsbeitrag
news:za******************************@bt.com...
>You can response.write a normal checkbox;

response.write ("<input type=\"checkbox\" name=\"chkMe_One\">");

Then use Request.Form or Request.Querystring to read its value.

"Mike Haberfellner" <un******@gmx.atwrote in message
news:b7***************************@news.inode.at. ..
>>...hi everyone,
...i posted this allready, but my newsreader doesn't display it to
me -
so i'm sorry if it's posted twice...
hi again,

sorry for not clearly writing what i really need :)

if i have the following in the aspx file

<body>
...
<asp:CheckBox ID="chkMe_One" runat=server/><br />
<% void_write_checkbox(); %>
...
</body>
and in the aspx.cs file

public void_write_checkbox()
{
Response.Write("<asp:CheckBox ID=\"chkMe_Two\" runat=server/>");
}
the second checkbox is not appearing.

the problem is, i need to put it onto the page via response.write()

can anybody help me please?

big thanx

mike

Mar 6 '07 #4

P: n/a
You may try the following

Dim chkbx As New CheckBox
chkbx.ID = "chkMe_Two"

chkbx.RenderControl(New HtmlTextWriter(Response.Output))

--
Abdul Aleem
Blog: http://aleemkhan.wordpress.com
"Mike Haberfellner" <un******@gmx.atwrote in message
news:eb***************************@news.inode.at.. .
but the problem with that is, that i cant access the "normal checkbox" by

foreach (Control locCtrl in this.Controls)...

or by

findcontrol("chkMe_One");

i need to go through all checkboxes and check their checked-state and name

thanx

mike

"Aidy" <ai**@noemail.xxxa.comschrieb im Newsbeitrag
news:za******************************@bt.com...
>You can response.write a normal checkbox;

response.write ("<input type=\"checkbox\" name=\"chkMe_One\">");

Then use Request.Form or Request.Querystring to read its value.

"Mike Haberfellner" <un******@gmx.atwrote in message
news:b7***************************@news.inode.at. ..
>>...hi everyone,
...i posted this allready, but my newsreader doesn't display it to me -
so i'm sorry if it's posted twice...

hi again,

sorry for not clearly writing what i really need :)

if i have the following in the aspx file

<body>
...
<asp:CheckBox ID="chkMe_One" runat=server/><br />
<% void_write_checkbox(); %>
...
</body>

and in the aspx.cs file

public void_write_checkbox()
{
Response.Write("<asp:CheckBox ID=\"chkMe_Two\" runat=server/>");
}

the second checkbox is not appearing.

the problem is, i need to put it onto the page via response.write()

can anybody help me please?

big thanx

mike



Mar 7 '07 #5

This discussion thread is closed

Replies have been disabled for this discussion.