We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on : Nov 16th 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

how to mark a row as selected in a grid control in code behind

Thread ID:

Created:

Updated:

Platform:

Replies:

117611 Nov 15,2014 05:41 PM UTC Feb 11,2015 09:52 AM UTC ASP.NET Web Forms 3
loading
Tags: Grid
Roimer Machacón Otero
Asked On November 15, 2014 05:41 PM UTC

Hi, we're using a grid control and want show to the users by default the first row of the grid mark as selected, exist a form to do this in code behind vb.net?

Madhu Sudhanan P [Syncfusion]
Replied On November 17, 2014 09:24 AM UTC

Hi Nestro,

 

Thanks for using Syncfusion products.

 

We have created a new incident #132102 on behalf of you related to this forum. We suggest you to follow up the incident for further reference using your direct trac account.

 

Please let us know if you have any concerns.

 

Regards,

Madhu Sudhanan. P


Roimer Machacón Otero
Replied On February 10, 2015 08:31 PM UTC

Hi with respect to the grid I've another question.

How can know when a grid have rows? That a grid if not empty, this in vb.net code no javascript!

Madhu Sudhanan P [Syncfusion]
Replied On February 11, 2015 09:52 AM UTC

Hi Nestro,

Query: “How can know when a grid have rows? That a grid if not empty, this in vb.net code no javascript!”

We can achieve your requirement in the following way, please refer the below code snippet.

[Code behind]

Dim employee As List(Of EmployeeView) = New NorthwndDataContext().EmployeeViews.ToList()

Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        Me.Grid.DataSource = employee

        'Check whether the employee list has data if so set the SelectedRowIndex as 0 else -1

        Me.Grid.SelectedRowIndex = If(employee.Count = 0, -1, 0)

        Me.Grid.DataBind()

    End Sub

[ASPX]

<ej:Grid ID="Grid" runat="server" AllowPaging="true">

      . . . . . . . . .  

</ej:Grid>

In the above code snippet, we have set the SelectedRowIndex if the employee list contains data else it is set as -1.

Please let us know if you have any queries.

Regards,

Madhu Sudhanan. P



CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;