Solved

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

Posted on 2013-11-05
4
777 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

632 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