473,426 Members | 1,543 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,426 software developers and data experts.

Programatically select datagrid row

I have a Windows form that contains a datagrid populated
with a table in my database.

When i load my form i want a particular row in my datagrid
to be selected.

How can i do that

Thanks
Nov 15 '05 #1
1 4851

Hi,

Thanks for posting in this group.
First, in form load event, you should bind the datatable in the dataset to
the datagrid, then you should use DataGrid.Expand(-1) to expand the
datagrid.
Finally, you can use DataGrid.Select(rownumber) method to select a certain
row.

If you have anything unclear, please feel free to tell me.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
| Content-Class: urn:content-classes:message
| From: "developer" <de*******@sogescom.net>
| Sender: "developer" <de*******@sogescom.net>
| Subject: Programatically select datagrid row
| Date: Wed, 29 Oct 2003 18:01:54 -0800
| Lines: 9
| Message-ID: <0d****************************@phx.gbl>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="iso-8859-1"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
| Thread-Index: AcOeicqTKgOiZQX/S+C2exWB0oexTA==
| Newsgroups: microsoft.public.dotnet.languages.csharp
| Path: cpmsftngxa06.phx.gbl
| Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.languages.csharp:195261
| NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
| X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
|
| I have a Windows form that contains a datagrid populated
| with a table in my database.
|
| When i load my form i want a particular row in my datagrid
| to be selected.
|
| How can i do that
|
| Thanks
|

Nov 15 '05 #2

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

Similar topics

3
by: Gil | last post by:
Hello, I use VB.NET and have a series of linkbuttons that are inside individual <td>s. Like this: <td background="image.gif"><asp:linkbutton id="myID" runat="server"/></td> I would like...
4
by: Michelle Stone | last post by:
I want to programatically add rows to a datagrid that is bounded. How can I do this? The ITEMS property doesn't seem to have an ADD function. Thanks... (i gave up on the web form TABLE since it...
0
by: Dude | last post by:
I add a link button to the header of my datagrid as follows: If e.Item.ItemType = ListItemType.Header Then Dim myLink As New LinkButton() myLink.Text = "Add New" myLink.Attributes.Add("runat",...
0
by: AC | last post by:
I'm sure this is possible, I'm just having trouble wiht my implementation... How can you programatically add a DataGrid with with bound data to a page? I have a case where I don't have access to...
0
by: Dan Hartshorn | last post by:
VS.NET 2003, C#, Windows Server 2003. I have a datagrid and I want the last column to be either an EditCommandColumn or a template column, depending on a value I have. The value changes for each...
1
by: mg | last post by:
I create a datagrid using the Web Forms Toolbo The dataadapter,dataset and databind() code runs in a button eventhandler The headertext is currently determined by the column names of my SQL...
1
by: mg | last post by:
I have created a databound datagrid programatically (that is, without wizards) in my C# codebehind How can I programatically add sorting and paging to this datagrid?
1
by: DotNetJunkies User | last post by:
Hi, I was wondering if it is possible to load datagrid into datalist programatically using ITemplate interface with the following structure and place intp placeholder control. PlaceHolder -...
2
by: Tymbow | last post by:
I'm building a web application that is analogous to the Windows XP file explorer in function. The left column contains a TreeView, and the right column a DataGrid populated by selecting TreeView...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.