table id generated from datagrid

G

Guest

Hi All,
I have extended WebControl which contains a datagrid in it. I am using that WebControl dynamically in my code to show datagrid. When the datagrid is rendered in the browser the id of the table being rendered is a autogenerated one like '_ctl2', ** but I want to assign my own name to the html table id by exposing a property in my WebControl **.
I have tried to set the grid.Attributes["id"] = <customname>, but that is generating multiple ids, with one id with the id value I gave and another id with the autogenerated one.
Can anybody please reply how can I get to assign user choice name to the generated table id.

Thanks,
Shravan.

P.S : Please remove (NO) and (SPAM) to send a mail to me
 
K

Konrad Rotuski

i'm not sure whether i correctly understood the problem, but try assigning
child control's ID property to name you want (e.g. dg.ID = "innerTable")
 
G

Guest

Hi Rotuski,
But when I am assigning it using dg.Id = "innerTable", its generating html
with <table name="innerTable" id="_ctl2">
but I need <table name="innerTable" id="innerTable">

Id is more important to me here.

Thanks,
Shravan.
 

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

Top