Why some web controls do not have ID property?

  • Thread starter Thread starter John Dalberg
  • Start date Start date
J

John Dalberg

I am trying to attach a javascript to a ButtonColumn in each row in a
datagrid but the buttoncolumn doesn't have a ID property. Is there a way to
use a function similar to findcontrol where I find the buttoncolumns in
the code behind?

I am trying to avoid the syntax below because it's not dynamic.
WebControl button = (WebControl) e.Item.Cells[0].Controls[0];
 
A ButtonColumn is not a web control. It is an object which represents
_every_ field in that column. Put differently: every field in a column
is based on a column (such as its style, the data it displays, etc).

You could either use a TemplateColumn and specify the ID for each
control yourself, or do what you already suggested (which is quite
common as far as I know).
 
A ButtonColumn is not a web control. It is an object which represents
_every_ field in that column. Put differently: every field in a column
is based on a column (such as its style, the data it displays, etc).

You could either use a TemplateColumn and specify the ID for each
control yourself, or do what you already suggested (which is quite
common as far as I know).

System.Web.UI.WebControls.ButtonColumn implies it's a webcontrol.. no?
 

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

Back
Top