By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,254 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

Creating a form dynamically with a Repeater

P: n/a

I'm building a multi-lingual CMS. The user can add as many languages as
he likes. The user will be able to create sections for different
content (General, News Releases, etc...) in the db table tblSection.
For each section, the user will have to input the section name for each
language he is supporting in tblSectionLang.

So, if the user has a section called News, and he is supporting English
and French, two records will have to be inserted into tblSectionLang -
News and Nouvelles.

My first instinct was to use the gridview to display/create the parent
section object, and once a parent section object was created or
selected, I would use the Repeater control to check the number of
languages the CMS supports, and then render the appropriate number of
input fields. I've been toying with creating the controls dynamically
in a repeater's ItemTemplate, but the I don't understand how the IDs
are being generated, so I don't know how I can access their values. The
ItemTemplate I'm assigning looks something like this:

public class SectionItem : ItemTemplate
private counter = 0;
public void InstantiateIn(Control container)
TextBox tb = new TextBox();
tb.ID = "txtStatus" + counter.ToString();
counter += 1;

I'm getting the appropriate input fields on my page, but the IDs are
emitted as Repeater1_ctl13_txtStatus1, Repeater1_ctl115_txtStatus2,
Repeater1_ctl17_txtStatus3, etc...

Am I on the right track with this? Is there an easy way to access the
values of these dynamically rendered input fields? How do I know what
the IDs will be?



Jan 19 '07 #1
Share this Question
Share on Google+
1 Reply

P: n/a
<ha******@hotmail.comwrote in message
Am I on the right track with this?
The "usual" method for providing dynamic multilingual content is to use
resource files:

However, this really only works when you are displaying one language per
user at a time - in your case, you need to repeat the same content more than
once, so I guess your approach is probably the simplest to meet your
Jan 19 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.