将ID一个form1.aspx调用到另一个页面form2.aspx [英] Call ID one form1.aspx to another page form2.aspx
问题描述
现在所有代码都在form1.aspx中
有一个dropodwn fromdate to date和tabledata id in form1 .aspx所以当我从下拉列表和datepicker中选择值并单击按钮时,数据将显示在form1.aspx的表格中,当我点击表格中的任何记录时,grpah将显示在form1.aspx上
现在我想要当我点击表格中的记录然后我想在form2.aspx中打开此图表我如何做这个
form1 .aspx
< asp:DropDownList ID = regiondrop runat = server AutoPostBack = True
onselectedindexchanged = regiondrop_SelectedIndexChanged >
< / asp:DropDownList >
< input ID = fromdate value = dd / mm / yyyy runat = server clientidmode = static / >
< 输入 ID = todate 值 = dd / mm / yyyy runat = server clientidmode = 静态 / >
< 输入 type = 按钮 id = search_data class = sear_btn value = 搜索数据 / >
我尝试过:
这是代码用于在form1.aspx中显示图形
< script type = 文本/ JavaScript的跨度>>
$( function (){
$('' < span class =code-string>#tabledata')。on(' click',' tr', function ( ){
var row = $( this );
var regno = row.find(' td')[ 0 ]。firstChild.data;
var fromdate = $(' [ID * = fromdate]')。val();
var todate = $(' [ID * = TODATE]'跨度>)VAL();
var obj = {};
obj.RegNo = regno;
obj.fromdate = fromdate;
obj.todate = todate;
Getsumdata(obj);
return false ;
});
});
function Getsumdata(obj){
$ .ajax({
type: POST,
url: WebForm1.aspx / summarydata,
数据: JSON .stringify(obj),
contentType: application / json; charset = utf-8,
dataType: json,
async: true ,
缓存: false ,
成功:功能(结果){
ale rt( JSON .stringify(result.d));
console .log( JSON .stringify(result.d));
var data1 = result.d.split(' *')[ 0 ];
console .log( JSON .stringify(data1));
var data2 = result.d.split( *)[ 1 ];
console .log( JSON .stringify(data2));
alert(data1);
alert(data2);
$(' #sum')。highcharts( {
chart:{
type:' column'
} ,
title:{
text:' 组合图'
},
xAxis:{
categories: eval (data1),
title:{
text : null
}
},
la bels:{
items:[{
html:' 水果消费总量' ,
样式:{
left:' 50px',
顶部:' 18px',
color:(Highcharts.theme&& Highcharts.theme.textColor)|| ' black'
}
}]
},
系列: eval (data2),
pointRange: 120 * 3600 * 1000 ,
regresson: true ,
regressionSettings:{
type:' linear',
color: ' rgba(223,83,83,.9)'
}
// 系列:[{
// type:'column ',
// 名称:'简',
// 数据:[3,2,1,3,4]
// },{
// 类型:'列',
// 名称:'John',
// 数据:[2,3,5,7 ,6]
// },{
// type:'column',
// name:'Joe',
// 数据:[4,3,3,9,0]
// },
// ]
});
}
});
}
< / script>
现在我如何在form2中调用这些id。 aspx在form2.aspx中显示数据?
( function (){
(' #tabledata')。on(' 点击, tr', function (){
var row =
( this );
var regno = row.find( ' td')[ 0 ]。 firstChild.data;
var fromdate =
i have two forms . form1.aspx and form2.aspx.
Now all code in form1.aspx
There is dropodwn fromdate to date and tabledata id in form1.aspx so when i select value from dropdown and datepicker and click on button then data is display in table in form1.aspx and when i click on any record in table then grpah is displayed on form1.aspx
now i want when i click on record in table then i want to open this graph in form2.aspx how i do this
form1.aspx
<asp:DropDownList ID="regiondrop" runat="server" AutoPostBack="True" onselectedindexchanged="regiondrop_SelectedIndexChanged"> </asp:DropDownList> <input ID="fromdate" value="dd/mm/yyyy" runat="server" clientidmode="static" /> <input ID="todate" value="dd/mm/yyyy" runat="server" clientidmode="static" /> <input type="button" id="search_data" class="sear_btn" value="Search Data" />
What I have tried:
this is code for display graph in form1.aspx
<script type="text/javascript"> $(function () { $('#tabledata').on('click', 'tr', function () { var row = $(this); var regno = row.find('td')[0].firstChild.data; var fromdate = $('[ID*=fromdate]').val(); var todate = $('[ID*=todate]').val(); var obj = {}; obj.RegNo = regno; obj.fromdate = fromdate; obj.todate = todate; Getsumdata(obj); return false; }); }); function Getsumdata(obj) { $.ajax({ type: "POST", url: "WebForm1.aspx/summarydata", data: JSON.stringify(obj), contentType: "application/json;charset=utf-8", dataType: "json", async: true, cache: false, success: function (result) { alert(JSON.stringify(result.d)); console.log(JSON.stringify(result.d)); var data1 = result.d.split('*')[0]; console.log(JSON.stringify(data1)); var data2 = result.d.split("*")[1]; console.log(JSON.stringify(data2)); alert(data1); alert(data2); $('#sum').highcharts({ chart: { type: 'column' }, title: { text: 'Combination chart' }, xAxis: { categories:eval(data1), title: { text: null } }, labels: { items: [{ html: 'Total fruit consumption', style: { left: '50px', top: '18px', color: (Highcharts.theme && Highcharts.theme.textColor) || 'black' } }] }, series: eval(data2), pointRange:120 * 3600 * 1000, regresson: true, regressionSettings: { type: 'linear', color: 'rgba(223, 83, 83, .9)' } // series: [{ // type: 'column', // name: 'Jane', // data: [3, 2, 1, 3, 4] // }, { // type: 'column', // name: 'John', // data: [2, 3, 5, 7, 6] // }, { // type: 'column', // name: 'Joe', // data: [4, 3, 3, 9, 0] // }, //] }); } }); } </script>
now how i call these id in form2.aspx to display data in form2.aspx?解决方案(function () {
('#tabledata').on('click', 'tr', function () { var row =
(this); var regno = row.find('td')[0].firstChild.data; var fromdate =
这篇关于将ID一个form1.aspx调用到另一个页面form2.aspx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!