查看main.aspx.cs源码关于服务器端控件ID和客户端ID的映射,映射后客户端如何调用
// 注册客户端脚本,服务器端控件ID和客户端ID的映射关系
JObject ids = GetClientIDS(regionPanel, regionTop, btnShowHideHeader, mainTabStrip, txtUser,
txtOnlineUserCount, txtCurrentTime, btnRefresh);
....
string idsScriptStr = String.Format("window.DATA={0};", ids.ToString(Newtonsoft.Json.Formatting.None));
PageContext.RegisterStartupScript(idsScriptStr);
客户端生成的数据如何调用 window.DATA
window.DATA = {
"regionPanel": "regionPanel",
"regionTop": "regionPanel_regionTop",
"btnShowHideHeader": "regionPanel_regionTop_Toolbar1_btnShowHideHeader",
"mainTabStrip": "regionPanel_mainRegion_mainTabStrip",
"txtUser": "regionPanel_regionTop_Toolbar1_txtUser",
"txtOnlineUserCount": "regionPanel_regionTop_Toolbar1_txtOnlineUserCount",
"txtCurrentTime": "regionPanel_regionTop_Toolbar1_txtCurrentTime",
"btnRefresh": "regionPanel_regionTop_Toolbar1_btnRefresh",
"userName": "admin",
"userIP": "::1",
"onlineUserCount": 1,
"treeMenu": "regionPanel_regionLeft_treeMenu",
"menuType": "menu"
};
|