OK to use the same ID in each FormView template?

C

Cal Who

I'm looking at someone else's code and it contains a FormView with a
InsertItemTemplate and a EditItemTemplate.

In each template there is a
<asp:TextBox ID="titleTextBox"...

element.



That is the same ID is in both templates. It appears to work OK

Is that OK.

Is it a good way to program?

What happens if I use FindControl? Does it find the active one?



Thank in advance for any info
 
A

Andy O'Neill

Cal Who said:
I'm looking at someone else's code and it contains a FormView with a
InsertItemTemplate and a EditItemTemplate.

In each template there is a
<asp:TextBox ID="titleTextBox"...

element.



That is the same ID is in both templates. It appears to work OK

Is that OK.

Is it a good way to program?

What happens if I use FindControl? Does it find the active one?



Thank in advance for any info
yes.

It finds the id in html that's going to be emitted.
By definition, this is the "active" one.
 
C

Cal Who

Andy O'Neill said:
yes.

It finds the id in html that's going to be emitted.
By definition, this is the "active" one.

I take it that there is no advantage to using different IDs.


Thanks
 

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,009
Latest member
GidgetGamb

Latest Threads

Top