Replace a text by a control

G

gokul

Hi There,
Iam in the process of creating a very small content management system.
The need is....
I have a page displayed taking data from the database , both for the
template and the content.

I use a dropdown list box to display a list of countries.

The hitch is I have to display the dropdown at a specified marker tag
in the template so that I can get the user list of countries at a
specified place.

For E.x

<tr>
<td class="bold" width="100%"><br>
<br>
User Name:<br>
<input name="textfield" type="text" size="15" maxlength="20">
<br>
<br>
Password:<br>
<input name="textfield2" type="text" size="15" maxlength="20">
<br>
<br>
<span class="bold">Forgot your password?</span><br>
<br>
<span class="bold">Click here to register.</span>
<span> [#Country#]</span>
</td>
</tr>

The above is the html template it will be stored in the DB and pumped
out and displayed.
I have to replace the [#Country#] with the dropdown server control
which gets the populated data from the DB.

Or please suggest me a way how can I do it.
Thanks and Regards
Gokul
 
J

Juno

try this:
Read this template out of db as string, and divide the string into three
parts, the second part is [#Country#].
Add a placehoder control to your page, and then add first part as literal
control , and your dropdownlist control and then the third part.

like:
PlaceHolder1.Controls.Add(new Literate(sPart1))
PlaceHolder1.Controls.Add(Your DropDownList)
PlaceHolder1.Controls.Add(new Literate(sPart3))
 
G

gokul

Hi Juno,
Thanks for the tip.
What I do now is.... I have a place holder, have a literal control and
place it in the Place holder, by your tip Iam able to place the
control in to the page...but the problem is I want to replace it at a
particular point.
The replace is to be made with a particular text string by this
control (DropDownList).

Regards
GOKUL.

Juno said:
try this:
Read this template out of db as string, and divide the string into three
parts, the second part is [#Country#].
Add a placehoder control to your page, and then add first part as literal
control , and your dropdownlist control and then the third part.

like:
PlaceHolder1.Controls.Add(new Literate(sPart1))
PlaceHolder1.Controls.Add(Your DropDownList)
PlaceHolder1.Controls.Add(new Literate(sPart3))


--
Juno
MCSD.NET, MCDBA, MCSE
----------------------------------------------------------
Support Team of EasyDotNet, INC. http://www.EasyDotNet.com
DataForm.NET - The most powerful data entry web server control for ASP.NET



gokul said:
Hi There,
Iam in the process of creating a very small content management system.
The need is....
I have a page displayed taking data from the database , both for the
template and the content.

I use a dropdown list box to display a list of countries.

The hitch is I have to display the dropdown at a specified marker tag
in the template so that I can get the user list of countries at a
specified place.

For E.x

<tr>
<td class="bold" width="100%"><br>
<br>
User Name:<br>
<input name="textfield" type="text" size="15" maxlength="20">
<br>
<br>
Password:<br>
<input name="textfield2" type="text" size="15" maxlength="20">
<br>
<br>
<span class="bold">Forgot your password?</span><br>
<br>
<span class="bold">Click here to register.</span>
<span> [#Country#]</span>
</td>
</tr>

The above is the html template it will be stored in the DB and pumped
out and displayed.
I have to replace the [#Country#] with the dropdown server control
which gets the populated data from the DB.

Or please suggest me a way how can I do it.
Thanks and Regards
Gokul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top