Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Evaluate Checkboxes entered at Runtime (http://www.velocityreviews.com/forums/t465970-evaluate-checkboxes-entered-at-runtime.html)

Michael Haberfellner 03-05-2007 03:49 PM

Evaluate Checkboxes entered at Runtime
 
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[i] + "\" class=\"checkboxStd\"
type=\"checkbox\" name=\"chkTimeDisplay" + varReader[i] + "\" />

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





bruce barker 03-05-2007 04:11 PM

Re: Evaluate Checkboxes entered at Runtime
 
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)

Michael Haberfellner wrote:
> 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[i] + "\" class=\"checkboxStd\"
> type=\"checkbox\" name=\"chkTimeDisplay" + varReader[i] + "\" />
>
> 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
>
>
>
>


Michael Haberfellner 03-06-2007 08:27 AM

Re: Evaluate Checkboxes entered at Runtime
 
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

bruce barker wrote:
> 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.
>



All times are GMT. The time now is 04:52 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.