Solved

How to get the properties of a grid in another Razor view?

Posted on 2013-11-05
4
764 Views
Last Modified: 2013-11-13
Hi,

I have a partial view:
@{
    var grid = Html.DevExpress().GridView(settings =>
    {
        settings.Name = "GridView";
        settings.CallbackRouteValues = new { Controller = "Home", Action = "GridViewPartialSimaTabla" };

        settings.SettingsEditing.AddNewRowRouteValues = new { Controller = "Home", Action = "GridViewPartialSimaTablaAddNew" };
        settings.SettingsEditing.UpdateRowRouteValues = new { Controller = "Home", Action = "GridViewPartialSimaTablaUpdate" };
        settings.SettingsEditing.DeleteRowRouteValues = new { Controller = "Home", Action = "GridViewPartialSimaTablaDelete" };
        settings.SettingsEditing.Mode = GridViewEditingMode.EditFormAndDisplayRow;
        settings.SettingsBehavior.ConfirmDelete = true;

        settings.CommandColumn.Visible = true;
        settings.CommandColumn.NewButton.Visible = true;
        settings.CommandColumn.DeleteButton.Visible = true;
        settings.CommandColumn.EditButton.Visible = true;

        settings.KeyFieldName = "szam";

        settings.SettingsPager.Visible = true;
        settings.Settings.ShowGroupPanel = true;
        settings.Settings.ShowFilterRow = true;
        settings.SettingsBehavior.AllowSelectByRowClick = true;

        settings.Columns.Add("szam");
        
        settings.Columns.Add("szoveg");
    });
    if (ViewData["EditError"] != null)
    {
        grid.SetEditErrorText((string)ViewData["EditError"]);
    }
}
@grid.Bind(Model).GetHtml()

Open in new window


In the Index.cshtml I have a TreeViewMenu which has an onclick:

    function TreeViewMenu_OnNodeClick(s, e) {
      
        alert(s.name + ' ' + e.node.text + ':' + e.node.name + '_');      

    }

Open in new window


How can I change let's say the caption of the grid's first column depending on the node?
I don't know even how to refer to the grid in this section.

Thank you
0
Comment
Question by:starhu
  • 2
  • 2
4 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 39627260
Are you asking how to refer to a DOM element within the JavaScript code?
0
 

Author Comment

by:starhu
ID: 39627658
If the grid is a Dom element, the yes.

(I'm a beginner in asp.net, sorry)
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 39627819
You will most likely be using document.getElementById to get a reference to the element.  It all depends on how the HTML is generated for the rendered page.  If your element is not assigned a unique ID, then it gets more complicated.
0
 

Author Closing Comment

by:starhu
ID: 39643942
I got a more precise answer with example from another forum
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question