Solved

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

Posted on 2013-11-05
4
761 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
I need help embedding an image as HTML in my vb.net application 3 48
c# string handling 1 26
Get id from json Data with NewtonSoft 3 32
Replace &lt; with < 14 54
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

914 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

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now