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 is the difference between pathparam and queryparam?

0 Answers  


What is difference between cookies and cache?

0 Answers  


Explain page output caching?

0 Answers  


Write some code using interfaces, virtual methods, and an abstract class`

0 Answers  


can sn.exe can be used before gacutil.exe

2 Answers   Accenture,


What is CSS? What is the advantage os using CSS in ASP.NET Web Applications?

2 Answers   PCS,


Project Architecture (3tier, n-tier)

1 Answers   Syntel,


what is the role of aspx file ?

2 Answers   Netsweeper,


About Garbage Collector?

3 Answers   Microsoft,


What is Cookies Less Session?

0 Answers  


What is ViewState ? and how it is managed ?

1 Answers  


How does the XmlSerializer work? What ACL permissions does a process using it require?

2 Answers  


Categories