How to add client row click funciton on datagrid

B

bg

is there anyone help me,
i want to add rowclick javascrip function on asp.net datagrid

what can i do this.

bgun
 
E

Eliyahu Goldin

You need to add "onclick" Attribute to the grid items. You can do it in
either ItemDataBound or PreRender event.

Eliyahu
 
E

Eliyahu Goldin

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

// provide client-side selection a datagrid row upon clicking any place on
the row.

ListItemType itemType = e.Item.ItemType;

if ((itemType == ListItemType.Pager) ||

(itemType == ListItemType.Header) ||

(itemType == ListItemType.Footer))

{

return;

}

e.Item.Attributes["onclick"] = "onAlertsRowClick(this)";

}


Eliyahu
 
B

bg

Thanks a lot.

-----------------------
Eliyahu Goldin said:
private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)

{

// provide client-side selection a datagrid row upon clicking any place on
the row.

ListItemType itemType = e.Item.ItemType;

if ((itemType == ListItemType.Pager) ||

(itemType == ListItemType.Header) ||

(itemType == ListItemType.Footer))

{

return;

}

e.Item.Attributes["onclick"] = "onAlertsRowClick(this)";

}


Eliyahu

bg said:
Can you give me code snippet with doing by ItemDataBound

Thanks
 
K

Ken Webster

A code example would be helpful. That's exactly what I've been trying to do
all afternoon!
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top