473,385 Members | 1,907 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

how to select a row in gridview in asp.net

hi

how can we select a row in a gridview with out select column and get
events fired

thanks

Aug 1 '07 #1
5 39702
"Dinu" <vi*******@gmail.comwrote in message
news:11**********************@e16g2000pri.googlegr oups.com...
how can we select a row in a gridview with out select column and get
events fired
<asp:GridView ID="MyGridView" runat="server"
OnRowDataBound="MyGridView_RowDataBound"
OnSelectedIndexChanged="MyGridView_SelectedIndexCh anged">
....
....
....
</asp:GridView>

protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(MyGridView, "Select$" +
e.Row.RowIndex.ToString()));
e.Row.Style.Add("cursor", "pointer");
}
}

protected void MyGridView_SelectedIndexChanged(object sender, EventArgs e)
{
string strSelectedID = MyGridView.SelectedValue.ToString();
}
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 1 '07 #2
On Aug 1, 5:20 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Dinu" <visitd...@gmail.comwrote in message

news:11**********************@e16g2000pri.googlegr oups.com...
how can we select a row in a gridview with out select column and get
events fired

<asp:GridView ID="MyGridView" runat="server"
OnRowDataBound="MyGridView_RowDataBound"
OnSelectedIndexChanged="MyGridView_SelectedIndexCh anged">
...
...
...
</asp:GridView>

protected void MyGridView_RowDataBound(object sender, GridViewRowEventArgs
e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(MyGridView, "Select$" +
e.Row.RowIndex.ToString()));
e.Row.Style.Add("cursor", "pointer");
}

}

protected void MyGridView_SelectedIndexChanged(object sender, EventArgs e)
{
string strSelectedID = MyGridView.SelectedValue.ToString();

}

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
It is not working, the page got hanged (i am using vb.net as code-
behind)

Protected Sub gvwServices_RowDataBound(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.GridViewRowEventArgs) Handles
gvwServices.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.Attributes.Add("onclick",
ClientScript.GetPostBackEventReference(gvwServices , "Select$" +
e.Row.RowIndex.ToString()))
e.Row.Style.Add("cursor", "pointer")
End If
End Sub

Aug 1 '07 #3
"Dinu" <vi*******@gmail.comwrote in message
news:11**********************@e16g2000pri.googlegr oups.com...
It is not working, the page got hanged
On which line does the code hang...?
(i am using vb.net as code-behind)
That certainly shouldn't make any difference...
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 1 '07 #4
On Aug 1, 8:20 pm, "Mark Rae [MVP]" <m...@markNOSPAMrae.netwrote:
"Dinu" <visitd...@gmail.comwrote in message

news:11**********************@e16g2000pri.googlegr oups.com...
It is not working, the page got hanged

On which line does the code hang...?
(i am using vb.net as code-behind)

That certainly shouldn't make any difference...

--
Mark Rae
ASP.NET MVPhttp://www.markrae.net
hi

my page has huge amount of data nearly(12500 records to be fetched
from database) and so it is hanged........if i use paging its working.

Thanks

Aug 2 '07 #5
"Dinu" <vi*******@gmail.comwrote in message
news:11**********************@e9g2000prf.googlegro ups.com...
my page has huge amount of data nearly(12500 records to be fetched
from database) and so it is hanged........if i use paging its working.
Sorted then... :-)
--
Mark Rae
ASP.NET MVP
http://www.markrae.net

Aug 2 '07 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: David Hubbard | last post by:
I am using a GridView to display a set of objects that have a parent-child relationship. Each object, MyBO, has an ID property that is used to get the children of that object. class MyBO { ...
4
by: Dabbler | last post by:
Is there a way to let the user select a gridview row by clicking anywhere in the row (e.g. on any column)? The gridview would be readonly and I would like to bring up a detailview of the row the...
6
by: Terry | last post by:
Good morning! How do I determine which SELECT button was clicked in a GridView? The multiple SELECT buttons will be used for an application approval process. Thank you in advance for your...
1
by: K B | last post by:
Hi. I have a gridview with sqldatasource, etc. For the grid, I also have a search textbox. If the user needs to filter the records, I want to dynamically adjust the SELECT statement for the...
0
by: jmacduff | last post by:
Big question: How to enable edit/update commands to work when setting the sqldatasource select command from code behind. Details: I have a GridView using a sqldatasouce with the select and...
0
by: jobs | last post by:
I have a gridview that times when selecting from specific table when I try to when I add a where clause. Even when I'm only seleting Top 1 which comes right back at the command line. I test the...
4
by: Luqman | last post by:
I have populated the Child Accounts and Parent Accounts in a Grid View Control, I want to hide the Select Column of Parent Accounts, but not the Child Accounts, is it possible ? I am using VS...
2
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
Based on wether a row is selected in a GridView I need to HIDE the last two columns of a gridview. I do NOT need to make the cells invisible I want to hide the entire column. When I set the...
15
JustRun
by: JustRun | last post by:
I have a problem with the select option at the gridview and gonna pull my hair out cause it doesn't work at all. Here is the Grid view code: I want to get the selected row when the user click...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.