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.

Answers were Sorted based on User's Feedback



hi i have a problem regarding to datagrid in aspdotnet.i have a datagrid in my application.i have ..

Answer / anant anand gupta

You can use the ItemCommand event of the datagrid.
give each command button a 'CommandName'
And 'CommandArgument' if required. CommandArgument you can
assign at the time of ItemDataBound (or RowDataBound) event
of the DataGrid. In the event handler method you can check
for the command name and perform the required task.

Is This Answer Correct ?    2 Yes 0 No

hi i have a problem regarding to datagrid in aspdotnet.i have a datagrid in my application.i have ..

Answer / 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

hi i have a problem regarding to datagrid in aspdotnet.i have a datagrid in my application.i have ..

Answer / sasireddy

Hey,

There is one more option do that.i.e. Take one
Tepletecolumn,in that u should like this

<asp:TemplateColumn HeaderText="Add/Edit/Delete">

<ItemTemplate>

<font face="verdan" size="2"><a href="Add.aspx"
runat="server" ID="A1">Add</a>&nbsp;&nbsp;<a
href="Edit.aspx" runat="server"
ID="A2">Edit</a>&nbsp;&nbsp;<a href="Delete.aspx"
runat="server" ID="A3">Delete</a>

</font>

</ItemTemplate>

</asp:TemplateColumn>

from this you can do Process.......

Is This Answer Correct ?    0 Yes 0 No

hi i have a problem regarding to datagrid in aspdotnet.i have a datagrid in my application.i have ..

Answer / sudhir kunnure

Just i want to say you that remove server side code for
page redirect when link click instead that write client
side code.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More ASP.NET Interview Questions

I need some questions regarding asp.net for 1.5yrs of Experience.

1 Answers  


What is cached data phone?

0 Answers  


What is web.config. How many web.config files can be allowed to use in an application ?

10 Answers   Accenture, BirlaSoft, Infosys, InterGraph, Satyam, Wipro,


Explain the difference between value type and reference type?

0 Answers  


what is the difference b/w .net 1.1 and 2.0 ?

2 Answers   Polaris,






What is the equivalent of date() and time() in asp.net?

0 Answers  


Explain the difference between asp.net mvc and asp.net webforms

0 Answers  


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

2 Answers   Microsoft,


To which class you load XML or Related Data

1 Answers  


Difference between abstract class and interface

2 Answers   Fidelity,


What are the steps involved to fill a dataset?

0 Answers  


What are validator? How do you disable them?

0 Answers  


Categories