Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Click a row on a datagrid to call SelectedIndexChanged event c#

Thread Tools

Click a row on a datagrid to call SelectedIndexChanged event c#

Posts: n/a

I have a datagrid in c#. When you move the mouse over the lines they
highlight. What I really want is for the user to be able to click
anywhere on a line and the 'SelectedIndexChanged' event be called -
enabling me to open another page to edit that selected record.

So, firstly I added a bound Select button, and as expected when I
click the SelectedIndexChanged event gets called, next stage was to
make that button invisible but add the following code to the datagrid
ItemDataBound event...

//This highlights on mouse over - works fine!
"'Silver'; lor='white';'hand'");

//this unhighlights on mouseout - works fine also!
"'white'; or='black';'hand'");

//this calls the doPostBakc function passing parameters just as the
'select' button does, but it doesnt call the SelectedIndexChanged
event :'(
e.Item.Attributes.Add("onclick","javascript:__doPo stBack('" +
"dgAllPosts:" + "_ctl" + 1 + ":_ctl0','')");

Anyways, if anyone can see what I'm doing wrong, or has a better way
to achieve this, I'd love to hear from you.

Thanks chaps

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
stumped...table - row - click event, cancel checkbox event dave ASP .Net Building Controls 0 09-02-2006 01:28 AM
DataGrid help on Datagrid's SelectedIndexChanged event Eric ASP .Net Web Controls 1 05-21-2005 05:15 AM
how do i access a dropdownlists selected value in a datagrid edititemtemplate column from the selectedindexchanged event of another dropdownlist in a datagrid edititemtemplate column Dave M ASP .Net Datagrid Control 0 12-14-2004 11:53 AM
image button click event fires before click event of button Purvi T ASP .Net 0 10-19-2004 06:19 AM
Button.Init? how Do I know if click event has been fired? TextBox.TextChanged event before Button.Click in a CompositeCustomControl. jorge ASP .Net 2 05-25-2004 11:45 PM