javascript - Generic solution to manage windows with ASP.NET MVC -


i have 3 different cases in project opening new window. when click link in window, expected 1 of following solutions:

i use following types window open:

_blank
_self
_parent

i have following columns opening new window:

code          width   height   behaviour accountpage    400      600      self prospectpage   700      700      blank passwordpage   200      200      single 

i need pass specific parameters javascript width, height , code. code used screen open , take parameters. have invoicepage, prospectpage,searchpage etc. if invoicepage opened width 200 or if prospectpage opened width 400px.

what proper way manage , pass javascript window open types , parameters in generic technique? how can prepare classes , types?

i tried use meta tag in layoutgeneral.cshtml pass dataset javascript couldn't it.

<meta name="iristabheadername" content="@model.windowinfo" /> 

should hold data in baseviewmodel , pass parameters javascript there or should hold cases in javascript , call cshtml page class?

the way of passing dataset javascript wrong. can hold page parameters enumeration or in json object , deserialize follows:

  var data = '[{     "code": {         "accountpage": { "width": "400", "height": "600", "name": "_self" },            "prospectpage": { "width": "700", "height": 700, "name": "_blank" },         "passwordpage": { "width": "200", "height": "200", "name": "passwordpage" }     } }]'; 

add data.json file in script source:

<script type="text/javascript" src="data.json"></script> 

and object json file in javascript:

var pagerules = json.parse(data); 

and can check attach 'a' tag's click event:

$(function () {     $("a").click(mylinkclickfunc); });  function mylinkclickfunc() {     var $this = $(this);     var attrname = $this.attr("name");     var params = null;      if (typeof attrname !== typeof undefined && attrname !== false) {         params = pagerules.code[attrname];         if(params == null)         {             var authcode = attrname.substr(0, attrname.indexof('_'));             params = pagerules.code[authcode];         }     }      if (params != null)     {         mypopupopener($this.attr("href"), params.name, params.width, params.height);     } } 

Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

serialization - Convert Any type in scala to Array[Byte] and back -

SonarQube Plugin for Jenkins does not find SonarQube Scanner executable -