DataGrid

  • Thread starter Thread starter TCB
  • Start date Start date
T

TCB

How can I make a linkbutton on a datagrid call a javascript that pops up a
window depending on the record number, I mean... I send the page and
querystring to the javascript that pops the window. i have done it with an
image using the onclick=... but how to do this whith a link button?

Thanks
 
the solution for this one is u have to find the link button id in
itemdatabound property of datagid
for that button u have to add attributes onclick and call the java
script function wchich call pop up page
 
Thank you, but in ItemDataBound, how can I get the value of come of the
columns being bound to that item si i can append it to the javascript that
calls the popup?

Regards,
 
You can use

LinkButton link = e.Item.Cells[col_index].Controls[0] as LinkButton;
or
LinkButton link = e.Item.FindControl("linkBtn_ID") as LinkButton;

link.Attributes.Add("onClick",javasciptfunction);

in ItemDataBound event


HTH

Elton Wang
 
TCB to add to sri's advice is that you can databind a label control in the
Itemtemplate
and in you onItemdatabound use findControl to get the id of the label u need
If you don't need field to show the label in your datagrid just make it
visible = false
Hope that helps
** If you need more help POST it
Patrick
 
Back
Top