473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

How to retain dynamically created web server control - help !!

Hello All,

I am programmatically building a table on my web page with one row and
two columns. The first column contains a web server checkbox
dynamically created and the second column simply contains text of
whatever I put in. This is running fine. If I check the checkbox, how
would I check if this checkbox is checked or not during postback? The
dynamically
created checkbox seems to have disappeared during postback.

Thanks in advance.

May 1 '06 #1
4 1927
If you create a control programmatically, then when the page is reloaded you
must re-create it. If enableViewState is true and the id of the control is
the same, then it will be able to hook back up with its ViewState.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"sy********@gmail.com" wrote:
Hello All,

I am programmatically building a table on my web page with one row and
two columns. The first column contains a web server checkbox
dynamically created and the second column simply contains text of
whatever I put in. This is running fine. If I check the checkbox, how
would I check if this checkbox is checked or not during postback? The
dynamically
created checkbox seems to have disappeared during postback.

Thanks in advance.

May 1 '06 #2
Thanks for responding. Do you have some references / links where I can
take a look at some examples of how this is done?

Peter wrote:
If you create a control programmatically, then when the page is reloaded you
must re-create it. If enableViewState is true and the id of the control is
the same, then it will be able to hook back up with its ViewState.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"sy********@gmail.com" wrote:
Hello All,

I am programmatically building a table on my web page with one row and
two columns. The first column contains a web server checkbox
dynamically created and the second column simply contains text of
whatever I put in. This is running fine. If I check the checkbox, how
would I check if this checkbox is checked or not during postback? The
dynamically
created checkbox seems to have disappeared during postback.

Thanks in advance.


May 2 '06 #3
Got this to work. Thanks for the info.

sy********@gmail.com wrote:
Thanks for responding. Do you have some references / links where I can
take a look at some examples of how this is done?

Peter wrote:
If you create a control programmatically, then when the page is reloaded you
must re-create it. If enableViewState is true and the id of the control is
the same, then it will be able to hook back up with its ViewState.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"sy********@gmail.com" wrote:
Hello All,

I am programmatically building a table on my web page with one row and
two columns. The first column contains a web server checkbox
dynamically created and the second column simply contains text of
whatever I put in. This is running fine. If I check the checkbox, how
would I check if this checkbox is checked or not during postback? The
dynamically
created checkbox seems to have disappeared during postback.

Thanks in advance.


May 2 '06 #4
I thought I had it working but not quite. When I enumerate through my
Repeater and evaluate which checkbox is checked, it always comes back
as being not checked on every row. Here's excerpt the code:

For Each rpItem In ViewRepeater.Items
chkRespFlag = CType(rpItem.FindControl("chkSel"), CheckBox)
If Not IsNothing(chkRespFlag) then
If chkRespFlag.Checked Then
intSelected += 1
Else
intNotSelected += 1
End If
End If
Next

My intSelected is always = 0. When I do a "View Source" on the brower,
I do see some of the rows do have chkSel.Checked = "Checked". Yet,
when I evaluate, it is telling they are not checked. Can someone
explain this?

Thanks.
sy********@gmail.com wrote:
Got this to work. Thanks for the info.

sy********@gmail.com wrote:
Thanks for responding. Do you have some references / links where I can
take a look at some examples of how this is done?

Peter wrote:
If you create a control programmatically, then when the page is reloaded you
must re-create it. If enableViewState is true and the id of the control is
the same, then it will be able to hook back up with its ViewState.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"sy********@gmail.com" wrote:

> Hello All,
>
> I am programmatically building a table on my web page with one row and
> two columns. The first column contains a web server checkbox
> dynamically created and the second column simply contains text of
> whatever I put in. This is running fine. If I check the checkbox, how
> would I check if this checkbox is checked or not during postback? The
> dynamically
> created checkbox seems to have disappeared during postback.
>
> Thanks in advance.
>
>


May 2 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: theo | last post by:
Hi... I wish to extract the text content of an Xml file and assign it to DropDownList controls at runtime.I can get the Xml file text content into the DropDownList controls (Ex...if 5 Xml text...
0
by: John Crowley | last post by:
I'm having an odd problem with viewstate and a dynamically created control inside a repeater template. Basically, I have a repeater setup like this in the aspx:
8
by: Donald Xie | last post by:
Hi, I noticed an interesting effect when working with controls that are dynamically loaded. For instance, on a web form with a PlaceHolder control named ImageHolder, I dynamically add an image...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
1
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a HTML table (running as server control with the control ID: tblInsertSP). The table has 16 rows with textboxes. Depending on the value of the ddlSPType, which...
2
by: Chad | last post by:
I have a problem that I am desperate to understand. It involves dynamically adding controls to a Table control that is built as a result of performing a database query. I am not looking to...
1
by: Jeffrey Todd | last post by:
I have successfully created functionality that mostly models what I'm trying to do - which is dynamically insert controls into a user control (ascx), and insert validation controls, also...
1
by: Marcus | last post by:
I have a problem maybe one of you could help me with. I've created a data entry screen with lots of dynamically-created client-side controls. I create HTML texboxes client-side by assigning a...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.