473,387 Members | 1,476 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,387 software developers and data experts.

ClientID and Request.form()

I am writing a composite control that allows two-way binding between a
collection of boolean values and a set of checkboxes.

In the CreateChildControls, I add each checkbox control that I need and
give it a numbered id/name while setting it's checked property as per
the values in my boolean collection.

When I create the control on postback, I pull the datasource out of
viewstate and re-create the checkboxes again with the data source but
at this point I also need to see if any of the checkboxes were changed
on the client and update the datasource as appropriate. I know this
seems odd but it lets me use formview/detailsview to update boolean
data by two-way databinding using the objectdatasource.

Anyway, my question!

The ClientID property of the parent control happens to be
"FormView1_Checklist1_whateverid" so I iterate through the request.form
collection looking for checkboxes that were actually checked. They are
called "FormView1$Checklist1$whateverid".

Am I going to be ok to just replace _ with $ when looking for this
POSTed data or is there another more appropriate way for me to access
posted data?

Sep 1 '06 #1
1 3390
You don't need to replace. UniqueID property returns the ID which is used as
key in POST collection (in Request.Form)

Another thing. If you add them as controls (and recreating on postback
doesn't happen with databinding) they should fire CheckedChanged event in
which you should get which ones were changed.

-
Teemu Keiski
ASP.NET MVP, AspInsider
Finland, EU
http://blogs.aspadvice.com/joteke
"cannontrodder" <ne**********@gmail.comwrote in message
news:11********************@i3g2000cwc.googlegroup s.com...
>I am writing a composite control that allows two-way binding between a
collection of boolean values and a set of checkboxes.

In the CreateChildControls, I add each checkbox control that I need and
give it a numbered id/name while setting it's checked property as per
the values in my boolean collection.

When I create the control on postback, I pull the datasource out of
viewstate and re-create the checkboxes again with the data source but
at this point I also need to see if any of the checkboxes were changed
on the client and update the datasource as appropriate. I know this
seems odd but it lets me use formview/detailsview to update boolean
data by two-way databinding using the objectdatasource.

Anyway, my question!

The ClientID property of the parent control happens to be
"FormView1_Checklist1_whateverid" so I iterate through the request.form
collection looking for checkboxes that were actually checked. They are
called "FormView1$Checklist1$whateverid".

Am I going to be ok to just replace _ with $ when looking for this
POSTed data or is there another more appropriate way for me to access
posted data?

Sep 3 '06 #2

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

Similar topics

1
by: Maras | last post by:
Hello, as we know VB is not case sensivity. I have a following problem, I have to send to another server few parametrs by post or get method, one of them MUST be a "clientID", it's preety...
2
by: kw | last post by:
TextBox t=new TextBox(); Controls.Add(t); t.ID=t.ClientID; //reads: "_MyControl1__ctl16" And even in OnPreRender, I examine the Controls collection and verify that the ID of the TextBox is...
2
by: Neo Geshel | last post by:
I need to get the ClientID of a form field for some JavaScript. About 25+ web sites I visited recommend the following method for finding the client ID of a web form: Web Form -> <asp:TextBox...
25
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the...
7
by: Stoyan Stratev | last post by:
I have a control whose ClientID is used in a number of Javascript routines. It turned out that the ClientID has a dash (-) in it and breaks the JS. Is there a way to change the ClientID of that...
2
by: JJ | last post by:
Hi, Can anyone advise me how is the ClientID issued? I had a suite Controls which consist of a context menu (i.e. a group of tables, rows and cells situated in a class library) and a set of...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.