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. Image for the cookie policy date
close icon

Hidden Column in the grid

Hi,
     I have couple of questions in the attached file.

Thanks for all your support.

Thanks,
Rajiv


Attachment: Couple_of_Questions_d77156bf.zip

1 Reply

SI Silambarasan I Syncfusion Team April 28, 2014 11:01 AM UTC

Hi Rajiv,

Thanks for using Syncfusion Products.

Query 1: “Is it possible to have a list of columns hidden with model”

We are glad to inform you that your requirement can be achieved by handling onLoad clientside event to set the column hidden. Please refer the following code snippet.

[CSHTML]

.ClientSideEvents(events =>{

events.OnLoad("addToHiddenColumn");

//...

})

[SCRIPT]

<script>

function addToHiddenColumn(sender) {

var gridObj = $find("OrdersGrid");

gridObj.hideColumn(sender.get_VisibleColumns()[5].Name);

}

</script>

 

Query 2: “Can we pass caption or hidden column value from the JavaScript?”

We can pass caption or hidden column values by using query string from script to controller. For passing multiple arguments, we use '&' to separate instead of using '?'. Please refer the below code snippet.

[SCRIPT]

<script>

function SelectionHandler(sender, args) {

window.open("NewScreen?caption=" + sender.get_Caption() + "&hiddenColumn=" +args.colObj[5].HeaderText + "&value=" + args.record.ShippedDate);

}

</script>

[CONTROLLER]

public ActionResult NewScreen(string caption, string hiddenColumn, string value)

{

ViewBag.Caption = caption;

ViewBag.HiddenColumn = hiddenColumn;

ViewBag.Value = value;

return View();

}

For your convenience, we have prepared a simple sample to demonstrate this and the same can be downloaded from the below link.

Sample:

http://www.syncfusion.com/downloads/support/directtrac/general/Sample_Project607872300.zip

 

Query 3: “When I use dataset.Tables[0].AsEnumerable() to get the model for the grid, in case of no data/result I get error while loading the grid. I want to be able to show no data returned in an empty grid.”

From this query, we have found that it is not feasible to bind the empty DataRow to the grid using DataTable. Because we need at least one DataRow to bind the column values into the grid otherwise we are not able to get the column values if the column is null. So empty DataRow binding is not possible in DataTable.

Query 4:One of our requirements is to have a link in the grid and be able to pass some values with it. How to achieve with the model we are using.”

Since this query already answered in the forum 116161, please follow-up the below link:

http://www.syncfusion.com/support/forums/aspnetmvcclassic/grid/116161

Please let us know if you need any further assistance.

Regards,

Silambarasan I


Loader.
Live Chat Icon For mobile
Up arrow icon