Evaluate Checkboxes entered at Runtime

  • Thread starter Michael Haberfellner
  • Start date
M

Michael Haberfellner

hi folks,

i do have the following problem (that nearly drives me nuts :)

1. within body-tags i call a void <% void_buildlist("lstService"); %>
2. this void connects to a database and creates code for a selfmade-grid
3. this is posted in the void by response.write and put on the website

up to here everything works fine!

now i added a checkbox for each gridline by adding this code to the text
created in the void in front of each gridline:

<input id=\"chkTimeDisplay" + varReader + "\" class=\"checkboxStd\"
type=\"checkbox\" name=\"chkTimeDisplay" + varReader + "\" />

4. this creates perfect checkboxes named chkTimeDisplay[+index] in every
gridline

works fine too!

5. but now i want to evaluate all checkboxes, using for example

foreach (Control locCtrl in this.Controls)
{
lblchecker.Text += locCtrl.FindControl + "; ";
if (locCtrl is CheckBox)
{
....do something
}
}

and here is the problem: no result! even if i use findcontrol with the
one correct checkboxname from the pagesource, there is no result :(

the controls can't be found. is it because they were produced during
runtime?

can anybody help me out?

thanx and nice greetings from vienna/austria

mike
 
B

bruce barker

if you create html controls, the page will know nothing about them. you
should create controls or use the Request.Form collection to get values.

-- bruce (sqlwork.com)
 
M

Michael Haberfellner

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top