模式字母窗口操作

exp1

1.Add one image button in datagrid  ,and code the javascript to pop up a model window .

<FooterTemplate>
<IMG style="CURSOR: hand" οnclick=javascript:ShowReference(); src="<%=Request.ApplicationPath%>/images/reference.gif">
</FooterTemplate>

<script language="javascript">
function ShowReference(){
//get the skuid from the modaldialog and refresh this page.
var SKU = window.showModalDialog('<%=Request.ApplicationPath%>/OM/FrmSKUReference.aspx', window.document, "dialogWidth:600px;dialogHeight:700px;");
if(SKU.length != null)
{
window.location.href('<%=Request.ApplicationPath%>/OM/FrmOrderItems.aspx');
}
}
</script>

2.in Model window get what u select in DataGrid

aspx:

<!add a hidden var to save the return value.>
<INPUT id="hdCloseWnd" type="hidden" name="hdCloseWnd" runat="server">

<ItemTemplate>
<!add a radiobutton >
<hlcontrols:radiobutton id="rdbProduct" AutoEventWireup="true" AutoPostBack=true text='<%#DataBinder.Eval(Container.DataItem,"ProductSKU").ToString().Trim()%>' runat="Server" onCheckedChanged="Radio_Clicked">
</hlcontrols:radiobutton>
</ItemTemplate>

add javascript  ,close the window  after getting what u select

<script language="javascript" type="text/javascript"> //update from here //this script block is to set the return value of this search window with the chosen SKU id. var closeWnd = document.Form1.hdCloseWnd; window.returnValue = document.Form1.hdCloseWnd.value; if(closeWnd!=null &amp;&amp; closeWnd.value.length &gt; 0) { window.close(); } //update end here </script> <script language="javascript">
//this script block is to set the return value of this search window with the chosen SKU id.
var closeWnd = document.Form1.hdCloseWnd;

window.returnValue = document.Form1.hdCloseWnd.value;
if(closeWnd!=null && closeWnd.value.length > 0)
{
window.close();
}

</script>

cs:

 protected void Radio_Clicked(object source, EventArgs e)
  {
   Herbalife.WebControls.RadioButton rbt = source as Herbalife.WebControls.RadioButton;
   Session[SessionKey.SearchCriteriaVO] = null;
   Session["SKUid"] = rbt.Text.Trim();
    hdCloseWnd.Value = rbt.Text.Trim();
  }

3 .In Main WIndow Add some code to get the seesion value when bounding  the datagrid
cs:

 private void InitializeComponent()
  {
   this.dgOrderItem.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.dgOrderItem_ItemCommand);
   this.dgOrderItem.ItemDataBound += new System.Web.UI.WebControls.DataGridItemEventHandler(this.dgOrderItem_ItemDataBound);
   this.Load += new System.EventHandler(this.Page_Load);

  }

 private void dgOrderItem_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
 {
  if(e.Item.ItemType==ListItemType.Footer)
  {
   Herbalife.WebControls.TextBox txtNSKU = e.Item.FindControl("txtNSKU") as Herbalife.WebControls.TextBox;
   txtNSKU.Text = (string) Session["SKUid"];
   Session.Remove("SKUid");
  }
 }

exp2

Sub WIndow :

aspx:

protected System.Web.UI.HtmlControls.HtmlInputHidden hdCloseWnd;

<script language="javascript" type="text/javascript"> var closeWnd = document.Form1.hdCloseWnd; window.returnValue = document.Form1.hdCloseWnd.value; if(closeWnd!=null && closeWnd.value.length > 0){ window.close(); } </script><script language="javascript" type="text/javascript"> var closeWnd = document.Form1.hdCloseWnd; window.returnValue = document.Form1.hdCloseWnd.value; if(closeWnd!=null && closeWnd.value.length > 0){ window.close(); } </script><script language="javascript" type="text/javascript"> var closeWnd = document.Form1.hdCloseWnd; window.returnValue = document.Form1.hdCloseWnd.value; if(closeWnd!=null && closeWnd.value.length > 0){ window.close(); } </script><script language="javascript">
var closeWnd = document.Form1.hdCloseWnd;
window.returnValue = document.Form1.hdCloseWnd.value;
if(closeWnd!=null && closeWnd.value.length > 0){
window.close();
}
</script>

cs:

 protected void Radio_Clicked(object source, EventArgs e)
  {
    
      Herbalife.WebControls.RadioButton rbt = source as Herbalife.WebControls.RadioButton;
   Session[SessionKey.SearchCriteriaVO] = null;
   Session[SessionKey.CustomerID] = rbt.Text.Trim();
   hdCloseWnd.Value = rbt.Text.Trim();
         
  }

Main Window:

aspx:

<script language="javascript">
function ShowSearchCust(){
cusID = window.showModalDialog('<%=Request.ApplicationPath%>/OM/FrmSearchCust.aspx', window.document, "dialogWidth:500px;dialogHeight:500px;");
txt = document.getElementById("ucHerbalifeIDControl_txtCustomerID");
if(cusID.length >0)
{
txt.value = cusID;
}
}
</script>

cs:

protected Herbalife.WebControls.ImageButton imglookup;

private void Page_Load(object sender, System.EventArgs e)
{
imglookup.Attributes.Add("onclick","javascript:ShowSearchCust();");

}<script language="javascript" type="text/javascript"> function ShowSearchCust(){ cusID = window.showModalDialog('<%=Request.ApplicationPath%>/OM/FrmSearchCust.aspx', window.document, "dialogWidth:500px;dialogHeight:500px;"); txt = document.getElementById("ucHerbalifeIDControl_txtCustomerID"); if(cusID.length >0) { txt.value = cusID; } } </script>

<script language="javascript" type="text/javascript"> //update from here //this script block is to set the return value of this search window with the chosen SKU id. var closeWnd = document.Form1.hdCloseWnd; window.returnValue = document.Form1.hdCloseWnd.value; if(closeWnd!=null &amp;&amp; closeWnd.value.length &gt; 0) { window.close(); } //update end here </script><script language="javascript" type="text/javascript"> function ShowReference(){ //update from here //get the skuid from the modaldialog and refresh this page. var SKU = window.showModalDialog('&lt;%=Request.ApplicationPath%&gt;/OM/FrmSKUReference.aspx', window.document, "dialogWidth:600px;dialogHeight:700px;"); //window.open('&lt;%=Request.ApplicationPath%&gt;/OM/FrmSKUReference.aspx',"",'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width=800,height=450,left=100,top=100') //txt = document.getElementById("txtNSKU"); if(SKU.length != null) { window.location.href('&lt;%=Request.ApplicationPath%&gt;/OM/FrmOrderItems.aspx'); } //update end here } function focusOnAddButton(object) { //alert(object.id); // var e = event.srcElement; var k = event.keyCode; if (k == 9) { } if (k == 13) { var addCtrl = object.parentElement.parentElement.children[11].children[0]; addCtrl.click(); event.cancelBubble = true; event.returnValue = false; } } </script>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值