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

Hidding a column in a grid asp.net mvc

Hi, i have a problme with the grid in mvc.

I want to hide a column. I found in mvcsample how it works.

But i need it directly after a page was loaded.
if i try to do something like this:

$(document).ready(function HideColumnByIndex(Indexval) {
var gridobj = $find("Grid1");
gridobj.hideColumnByIndex(Number(1));
});

i will get an null object. the findmethode doesn't find anything.
if i try $("#Grid1"); i will get an object but it doesn't have a hideColumnByIndex() function.

How i can Hide a column in a mvc grid on startup?

Thanks for answers. I need it cause i want to edit a row with a inlineedittemplate but i don't want to show the primarykey column.

Regards
Adrian


1 Reply

ES Eswari S Syncfusion Team March 15, 2011 06:00 AM UTC

Hi Adrian,

We have analyzed your query where the code you have given for hiding the column is fine. But it should be placed after the Script Manager() in Site. Master page.

hideColumnByIndex:

Please refer this code snippets:

<%=Html.Syncfusion().ScriptManager() %>



hideColumn:

We can also use “hideColumn” method to hide the columns. Here, the “OrderID” is the name of the Column to be hidden.

Please refer this code snippets:

<%=Html.Syncfusion().ScriptManager() %>


Note: We have already updated the same response for this query in the incident 78294.

Please let us know if you need further assistance.

Regards,
Eswari.S



Loader.
Live Chat Icon For mobile
Up arrow icon