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

Creating a form dynamically with a Repeater

Hi,

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;
*SNIP*

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?

Regards,

Chris

Jan 19 '07 #1
1 2278
<ha******@hotmail.comwrote in message
news:11*********************@s34g2000cwa.googlegro ups.com...
Am I on the right track with this?
The "usual" method for providing dynamic multilingual content is to use
resource files:
http://www.google.co.uk/search?sourc...2+multilingual

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
requirements...
Jan 19 '07 #2

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

Similar topics

0
by: David B | last post by:
Bare with me this is my first post. Objective: To dynamically create repeaters in a WebForm based on sets of data. Problem: When I attempt to create any Repeater from C# I get a big fat white...
12
by: Jerad Rose | last post by:
I searched for a while trying to find the answer to this, but to no avail. I am trying to find the best way (or any way) to dynamically show and hide groups of TR's. For example, I have a...
1
by: Onur Bozkurt | last post by:
I have a form to fill which has textbox's and dropdownlist's, but I don't know how many of them will the user fill on a page. So I want to give the number dynamically. I created a form and used...
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:
0
by: Diane Yocom | last post by:
I'm very new to ASP.Net and probably jumped in a little over my head, but... I'm trying to create a user control that will control navigation through my site. It's sortof like Amazon.com, where...
4
by: bob garbados | last post by:
I need to create a page that displays all of the products from a table and allows for add to cart functionality. My thoughts were to display all of the products in table rows using a repeater. ...
9
by: sck10 | last post by:
Hello, I am building a web form that will be used to gather information for marketing plans. The form will have 15 questions which must be answered. Each question can have large blocks of text....
4
by: mohaaron | last post by:
I can think of a lot of reasons why this might need to be done but as far as I can tell it's not possible. I've been looking for a way to add HtmlTableRows to a table using a button click for a...
1
by: Jack | last post by:
Hello All, I am new to ASP.NET, and i have a small project in hand. I hope someone can kick me in the right direction. I have to make a survey application. Data is stored in an sql database as...
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: 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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.