Click here to Skip to main content
15,895,656 members
Please Sign up or sign in to vote.
3.40/5 (2 votes)
See more:
Hello everybody,

I have a problem in my project, the problem is like this.

I have a fckeditor on my aspx page which gets html code generated from this editor that I store in a database.
After that I load the same html code on next page.

What I want to do is to access the values which are stored/selected in the html controls.

In simpler terms, my problem is that I want to access the html controls on a page through javascript or c# whose name I dont know (as I inserted them on runtime through fckeditor).

thanks...
Posted
Updated 22-Mar-11 10:46am
v2
Comments
Dalek Dave 22-Mar-11 16:47pm    
Edited for Grammar and Readability.

Its difficult (and doesn't make sense, in my opinion) finding controls who's names are not known. You may try the following JavaScript functions though.

document.getElementsByTagName()
document.getElementsByName()


These are functions that return an array of controls. You can find tons of tutorials for these JS functions on the net.
 
Share this answer
 
Comments
Dalek Dave 22-Mar-11 16:47pm    
Good Call.
hi,
You can use VWD-CMS, for one of my project and i faced similar situation and tried and found most convincing.You can take a look at sample given from here[^]. Hope this will solve your issue.
 
Share this answer
 
Comments
Dalek Dave 22-Mar-11 16:47pm    
Good Advice
for(int i=0;i<n;i++)><br />
{<br />
<br />
}
 
Share this answer
 
Hello,

In C# code-behind, you can loop through the Control collection of a given object.

If you know the 'type' of control you are looking for, and have an idea of what index it may be relative to it's parent, you could iterate through controls that way.

foreach (Control ctl in this.Controls)
if (typeof(ctl) == CheckBox)
{
CheckBox cbTemp = (CheckBox)ctl;
// do something with that control...
}

You could make it recursive, and thus go through all controls of each child control also, until you have looped through everything... but you will need something to look for, a specific control type, or the index of a given control within a given object's control collection...

Sorry couldn't be more help,
Frank
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900