hi i have a problem regarding to datagrid in aspdotnet.i
have a datagrid in my application.i have to place
add,edit,delete buttons or links what ever it may be.
now the problem is if i click on add button then the page
has to redirected to another form called "xyz.aspx" and if
i click on edit button the page has to redirected to
another form called "abc.aspx".i am phasing the problem
that if where ever i click on the datagrid the cursor goes
to gv1_SelectedIndexChanged event.please tell me the
solution about the code.

Answer Posted / vipal

For this grid have item bound property. in that you find
the control linkbutton used for add. And register script
for add button click event and call javascript function and
use window.location to redirect to the new page xyz.aspx.

protected void DataGrid_itemBound(Sender s,EventArgs e)
{
LinkButton LnkBtn = (LinkButton)DataGrid.item.FindControl
("LnkAdd");
LnkBtn.Attributes.Add("onclick","OpenNewPage();");
}

---in aspx page use script---
function OpenNewPage()
{
window.location = "xyz.aspx";
}

similarly find link button for edit and follow same process

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the web.config file in asp?

642


What is the displayafter property in updateprogress control?

512


Difference between DataGid and Girdview? Difference b/w .Net 2.0, 3.0 and 3.5 ? Diff b/w dispose & Finialize Methods?

2033


Who creates jsessionid?

568


Who generates session id?

496






What is the good practice to implement validations in aspx page?

640


What is globalization and localization in asp net?

498


Is razor a programming language?

535


What is the procedure to create the environment for asp.net? : asp.net mvc

519


What is x xss protection?

575


Why we use asp.net for website development?

501


What are validator? Name the validation controls in asp.net? How do you disable them?

550


Which object is used to encapsulate the state of the client and the browser in ASP.NET?

595


What is hidden field in asp.net?

604


Explain how viewstate is being formed?

545