How do you add a javascript function for a link button in a
datagrid?

Answers were Sorted based on User's Feedback



How do you add a javascript function for a link button in a datagrid?..

Answer / ish

Make object of particular button

Ex:

LinkButton lnbDelete=(LinkButton) e.Item.FindControl
("Delete");

After that we can use it with JavaScript:
lnbDelete.Attributes.Add("Onclick","javascript:return
confirm('Are you sure you want to delete this?');");

Is This Answer Correct ?    8 Yes 2 No

How do you add a javascript function for a link button in a datagrid?..

Answer / krishna prasad

in databound event
foreach(dataview/datagrid items)
{
find the linkbutton(objLinkButton) row.findcontrl
("LinkButtonID")
objLinkButton.attributes.add("onClick","return "validates
();")
}

Is This Answer Correct ?    4 Yes 1 No

Post New Answer

More ASP.NET Interview Questions

what are the application layers for a distribute application?

0 Answers   Mind Tree,


What ports must be open for DCOM over a firewall? What is the purpose of Port 135?

0 Answers  


What kind of data can be stored in viewstate?

0 Answers  


What is Hybrid dictionary

1 Answers  


What is webresource axd?

0 Answers  


what are the server controls used in sitepath navigation?

1 Answers  


What is Web API?

0 Answers  


Can you use c# without .net?

0 Answers  


what r the Templeats in ASP.net?

5 Answers   Intel, VBV,


What’s difference between “optimistic” and “pessimistic” locking?

0 Answers  


What are the differences between code behind and code inline?

0 Answers  


Why session is used in asp.net?

0 Answers  


Categories