How to Execute/Evaluate String in Asp.Net 1.1 using Vb.Net ?

K

Kamal Ahmed

Hi all,
I want to execute a String that is generated at Runtime and fills data in
DropDownList Controls at Runtime. I want to do this at server side. As Eval
functions works as client side function and there is not other function or
command to do this
example is here..
("ddlSub" & CStr(nRow) & ".DataSource = dtrSubject")
I want to evaluate this string to get name of control at runtime e.g.
ddlSub1, ddlSub2, ddlSub3 and so on

How it will be done using Asp.Net 1.1 using Vb.Net ?

TIA
 
K

Karl Seguin

You can do a Page.FindControl("CONTROL_ID");

note though that this isn't a recursive find (like client-side
getElementById()

for example, say the control you wanted was inside a placeholder:
<asp:placeholder id="plc" runat="server">
<asp:dropdownlist id="ddl" runat="server">
</asp:placeholder>

rather, you'll need to eitehr nest them:
Page.FindControl("plc").FindControl("ddl")

or base it off the parent control:
ddlontrol.FindControl("ddl")


of course, if the control isn't nested, you can just do
Page.FindControl("ControlId") and ignore everything I said except the first
line (Which is the same as this line!!)
Karl
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top