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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add CheckBox Column by using RowBtnTemplate

Thread ID:

Created:

Updated:

Platform:

Replies:

118077 Jan 29,2015 01:53 PM UTC Feb 13,2015 04:04 AM UTC ASP.NET Web Forms (Classic) 8
loading
Tags: GridGroupingControl
Dirk Hoffmann
Asked On January 29, 2015 01:53 PM UTC

Hello,
I hope someone can help me, because I've tried so many samples from the forum until now, but none of them worked.

I am using Version 11.4.0.26 of Essential Studio.

I have a GridGroupingControl on my page. The columns and the DataBinding is assigned dynamically in code.
The user should be able to select multiple rows and then perform some action fired by a button.
The button event is process by some server code.
How can I achieve this?

(I've tried to add a CheckBox Column to the grid, but that didn't work.)

Thanks for any helpful response!


Dirk Hoffmann
Replied On January 29, 2015 01:55 PM UTC

Sorry for the possibly misleading title ...

Shanmugaraja K [Syncfusion]
Replied On January 30, 2015 09:26 AM UTC

Hi Dirk,

Thanks for using Syncfusion products.

We would like to let you know that your requirement has been achieved by using Button OnClick Event. Please refer the below code snippets.

[ASPX]

<asp:Button runat="server" ID="btn" Text="click here" OnClick="Button_Click"/>

[CS]

protected void Page_Load(object sender, EventArgs e)

        {

            if (!IsPostBack)

            {

                GetData();

            }

            this.GridgroupingControl1.TableOptions.ListBoxSelectionMode = SelectionMode.MultiExtended; // For Select Multiple rows.

        }

  public void Button_Click(object sender, EventArgs e)

        {

        //Button Click fired to Here.

        }

For your convenience we have created simple sample with your requirement and the same can be downloaded from the following link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118077/WebApplication1-1856261089.zip

Please let us know if you need further assistance.

Regards,

Shanmugaraja K



Dirk Hoffmann
Replied On February 6, 2015 11:23 AM UTC

Hello,

thank you for the example!
This example works, but in my grid, the Ajax mode is enabled and I use Ajax autoformat for office2007Blue and ajaxactionmode = Server.
When I disable the ajaxmode, everything works fine. When I enabled the Ajaxmode, the multiextended selection mode does not work anymore.

Is there a way to get the multi selection work, with Ajax mode?

Thanks for your response.


Shanmugaraja K [Syncfusion]
Replied On February 9, 2015 10:14 AM UTC

Hi Dirk,

Thanks for your update.

We would like to let you know that your requirement has been achieved by handling Button OnClick and OnClientClick Events. Please refer the below code snippets.

[JS]

  function clickhere()

        {

            var obj = document.getElementById('<%= hidden.ClientID  %>')

            obj.value = $find("MainContent_GridgroupingControl1").get_SelectionManager().selectedRowsCollection; // store the selected records index in the hidden field.

        }

[ASPX]

<asp:HiddenField  runat="server" ID="hidden"/>

<asp:Button runat="server" ID="btn" Text="click here" OnClick="Button_Click" OnClientClick="clickhere()"/>

[CS]

public void Button_Click(object sender, EventArgs e)

        {

            var array = hidden.Value.Split(','); // can get the hidden field values (selected Records index) here.

            int[] records = array.Select(x => int.Parse(x)).ToArray();

            var selectedrecords = this.GridgroupingControl1.Table.Records[records[0]];//Get the selected Records here.

           //Button Click fired to Here

        }

For your convenience we have modified the sample and the same can be downloaded from the following link.

Sample: http://www.syncfusion.com/downloads/support/directtrac/118077/WebApplication1_(2)-501109235.zip

Please let us know if you need further assistance.

Regards,

Shanmugaraja K

Dirk Hoffmann
Replied On February 11, 2015 05:12 PM UTC

Hi,

Thanks again for your help!

This time, I wasn't able to get the example working on my computer.
I tried to rebuild it by copying the code to a new project, step by step.

Actually, I develop in vb.net, so I had to modify some peaces of your code.
Now,  I have problems with the JS function clickhere(). It says, that the grid does not have the get_SelectionManager Function.

But, I think there is another problem I have. When I start the project, everything works fine and the page shows up.
Now, I want to select multiple rows, like in the project without ajaxmode turned on, but the rows don't get selected. I can only select on row by a time, even when holding shift oder ctrl keys it does not work.

I have attached my project. Maybe you could help me again with this?

Thank you very much!

Attachment: WebApplication1_1e4376e3.zip

Shanmugaraja K [Syncfusion]
Replied On February 12, 2015 05:55 AM UTC

Hi Dirk,

Thanks for your update.

Query 1: get_Selectionmanager Function Issue.

We have analysed your attached sample and you have used Grid Element for get selectionmanager, we suggest you to use gridObj to get the SelectionManager. Please refer the below code snippets.

[JS]

function clickhere() {

            var obj = document.getElementById('<%= hidden.ClientID  %>')

            var gridid = document.getElementById('<%= Grid.ClientID  %>').id;

            obj.value = $find(gridid).get_SelectionManager().selectedRowsCollection;

            }

 

Query 2: Multi selection not working in ajax mode.

We are sorry about the inconvenience caused. We are unable to reproduce the issue in our end. We have attached video demonstration of the working of your sample and the same can be downloaded from the following link.

Video link: http://www.syncfusion.com/downloads/support/directtrac/118077/multirows1950143741.zip

Sample link: http://www.syncfusion.com/downloads/support/directtrac/118077/WebApplication11827500598.zip

Please try the above sample and get back to us if, you are able to reproduce the issue. If not, could you please give more information about the multi selection issue. Please provide issue replicated video or more code snippets with us. The information provided would be a great help by resolving the issue.

Please let us know if you need further assistance

Regards,

Shanmugaraja K



Dirk Hoffmann
Replied On February 12, 2015 12:19 PM UTC

Hello Shanmugaraja K,

now, everything works fine!
In the video, you used firefox for the test. I am using the IE. I tried the example with firefox and everything worked.
My problem was the selection of multiple rows while holding the ctrl key pressed. This didn't work with my IE. The solution finally were my security settings in the IE options.
After I had restored the microsoft default values for these settings, everything worked in the IE.

So, thank you very much, the problem is resolved.

Regards,

Dirk.

Shanmugaraja K [Syncfusion]
Replied On February 13, 2015 04:04 AM UTC

Hi Dirk,

Thanks for your update. 

We are glad to know that your issue has been resolved. Please let us know if you have any other concerns so that we will be happy to help you out.

Regards,
Shanmugaraja K



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

;