control id's - beginners question

J

JJ

I have a control that can be placed on any page 1 or more times (like a web
part).

The control loads text from database tables. Its the first time I've done
this so I just need a pointer to solve a very simple problem:

How do I tell the control which record to get the text from in the database?
e.g.. I could use a querystring - but that could get lengthy if there are
several controls doing the same thing on the one page.

My thought was to perhaps tie the control ID to the database record - i.e.
have a row for 'controlID' in each record, so all I have to do on load would
be to search for that controls 'id'. Is that the correct approach here?

My concern would be if that control's id property is autogenerated, and if
it would change if, for example, the control was moved to another area of
the page?

Any pointers greatfully received!

JJ
 
J

JJ

the control id would not be unique across all pages so I guess I'd have to
somehow generate it via the SQL database?
 
J

JJ

Scrap that question - I just add a 'txtrecordID' property to the control.

I'll get the hang of this asp.net one day....
 

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

No members online now.

Forum statistics

Threads
473,996
Messages
2,570,237
Members
46,825
Latest member
VernonQuy6

Latest Threads

Top