Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datalist problem with setting values to buttons

Status
Not open for further replies.

mkill22

Programmer
Apr 30, 2002
1
GB
Hi,

I have a datalist with a template which among other things adds a button to
each item from the SQL Database. I need to set the value of the id field of the record in
the db to the button like this:

<input type=button id='btn_<%# DataBinder.Eval(Container.DataItem, &quot;id&quot;)
%>' runat=&quot;server&quot; value=&quot;Button&quot; class=&quot;darkbluegrad&quot;>

The problem is I get this error:

' is not a valid identifier

How should I bind the id number to the id???

Thanks,
Matt
 
Hmmm...does it have to be the button that has the id?

Only reason I ask is that with a data grid (not a list I know, but they're similar) we just hide the first non-button column, and assign the ID value there. When a button is clicked, we grab the row the action was happenning in, grab the id value from the column, and continue on.

One alternative to trying to assign the button an id anyway.

The other thing you could try is either double quotes around the button id, or no quotes at all.

Jack
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top