protected void Button1_Click(object sender, EventArgs e) { if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "haha")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "haha", "<script language='javascript'>alert('ClientScriptBlock')</script>"); } }
protected void btnPreview_Click(object sender, EventArgs e) { try { string checkedRequiredField = ""; ResetSession(); string empKey = Request.QueryString.Get("EmpKey"); Report.LoadSourceDataSet(ref checkedRequiredField, empKey); if (checkedRequiredField != "") { ((PageBase)this.Page).ErrorMessage = checkedRequiredField; return; } Report.SetFilterValue(); String script = "javascript:ShowReportViewer();"; if (ClientScript.IsClientScriptBlockRegistered("scriptShowReportViewer").IsFalse()) { ClientScript.RegisterStartupScript(this.GetType(), "scriptShowReportViewer", script, true); } } catch (Exception ex) { ((PageBase)this.Page).ErrorMessage = (ExceptionHelper.getExceptionMessage(ex)); } }
protected void lnk_genTemplateRpt_OnClick(object sender, EventArgs e) { lblErr1.Text = ""; string _PY = txtTempPlanYear.Text; bool _exists = BenhierDAL.checkRatePY(_PY); if (_exists) { string msg = "Rates for entered plan year already defined!"; string alertScript = "<script language=JavaScript> alert('" + msg + "'); <" + "/script>"; if (!ClientScript.IsClientScriptBlockRegistered("alert")) { ClientScript.RegisterClientScriptBlock(typeof(Page), "alert", alertScript); } } else { DataSet dsrptTemp1 = new DataSet(); dsrptTemp1.Clear(); dsrptTemp1 = BenhierDAL.rateTemplate(_PY); string filename = "Rates_Template_" + _PY; string[] sheetnames = { "rates" + _PY }; string[][] titles = { new string[] { "" } }; string[][] colsFormat = { new string[] { "number", "string", "string", "string", "string", "string", "string", "decimal", "decimal", "number" } }; int[][] colsWidth = { new int[] { 70, 100, 90, 70, 200, 80, 80, 75, 90, 100 } }; CreateExcelRpt xlobj = new CreateExcelRpt(); xlobj.ExcelXMLRpt(dsrptTemp1, filename, sheetnames, titles, colsFormat, colsWidth, String.Empty); } }
public void Alert(string text) { if (!ClientScript.IsClientScriptBlockRegistered("script")) { ClientScript.RegisterStartupScript(this.GetType(), "script", "alert('" + text + "')", true); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // Form the script that is to be registered at client side. string scriptString = "<script language=JavaScript>"; scriptString += "function UpdateOpener(filename) {"; scriptString += "opener.document.Form1." + Request.QueryString["FieldID"] + ".value = filename;"; scriptString += "self.close(); return false; }"; scriptString += "function closeWindow() {"; scriptString += "opener.focus(); self.close(); return false;}"; scriptString += "</script>"; if (!ClientScript.IsClientScriptBlockRegistered("UpdateOpener")) { ClientScript.RegisterClientScriptBlock(GetType(), "UpdateOpener", scriptString); } uploadpanel.Visible = _uploadIsEnabled; _imageFolder = ((SettingItem)moduleSettings["FlashPath"]).FullPath; if (IOHelper.CreateDirectory(Server.MapPath(_imageFolder))) { DisplayImages(); } else { uploadmessage.Text = _noFolderSpecifiedMessage; } Response.Write(_imageFolder); }
protected void submit_Click(object sender, EventArgs e) { try { string message = "Dear " + txtname.Text + ",<br> Thank you for your Inquiry. We will get in touch with you shortly.<br> "; string content = "Name: " + txtname.Text + "<br> Contact number:" + contact.Text + "<br> Email: " + emailname.Text + "<br> Message: " + msg.Text; if (SendMailMessage(emailname.Text, "*****@*****.**", "", "Thanks for you inquiry", message + content + "<br>")) { txtname.Text = contact.Text = emailname.Text = msg.Text = string.Empty; string str = string.Empty; str = "<script language='javascript'>"; str = str + " var res=alert('Inquiry submitted');"; str = str + "if(res==true){ window.close();"; str = str + "}"; str = str + "else{ window.close();"; str = str + "}"; str = str + "</script>"; if (ClientScript.IsClientScriptBlockRegistered("messagebox") == false) { ClientScript.RegisterStartupScript(GetType(), "messagebox", str); } } else { txtname.Text = contact.Text = emailname.Text = msg.Text = string.Empty; } } catch (Exception ex) { throw ex; } }
protected void InicioButton_Click(object sender, EventArgs e) { if (!ClientScript.IsClientScriptBlockRegistered("script")) { ClientScript.RegisterStartupScript(this.GetType(), "script", "alert('El IdCategoria No Puede Estar Vacio Para Eliminar')", true); } }
private void ScriptCliente() { if (!ClientScript.IsClientScriptBlockRegistered("__ScriptCliente__")) { StringBuilder sScript = new StringBuilder(); sScript.AppendLine(""); sScript.AppendLine("function IsValid()"); sScript.AppendLine("{"); sScript.AppendFormat(" msg = '{0}';", Resources.Mensajes.msgConfirmación); sScript.AppendFormat(" strLogin = document.getElementById('{0}').value;", txtLogin.ClientID); sScript.AppendFormat(" strClave = document.getElementById('{0}').value;", txtClave.ClientID); sScript.AppendLine(" if (strLogin.length == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", "No ha colocado el login del usuario"); sScript.AppendFormat(" document.getElementById('{0}').focus();", txtLogin.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendLine(" if (strClave.length == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", "No ha colocado la clave de acceso"); sScript.AppendFormat(" document.getElementById('{0}').focus();", txtClave.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendFormat(" return true;"); sScript.AppendLine("}"); ClientScript.RegisterStartupScript(Page.GetType(), "__ScriptCliente__", sScript.ToString(), true); } }
private void ScriptCliente() { if (!ClientScript.IsClientScriptBlockRegistered("__ScriptCliente__")) { StringBuilder sScript = new StringBuilder(); sScript.AppendLine(""); sScript.AppendLine("function confirmacion(strMsje)"); sScript.AppendLine("{"); sScript.AppendFormat(" return confirm(strMsje);"); sScript.AppendLine("}"); sScript.AppendLine("function IsTextBusqNull()"); sScript.AppendLine("{"); sScript.AppendFormat(" msg = '{0}';", Resources.Mensajes.msgConfirmación); sScript.AppendFormat(" strCartelModelo = document.getElementById('{0}').value;", txtDescCartMod.ClientID); sScript.AppendLine(" if (strCartelModelo.length == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgCCNoSelCartModelo); sScript.AppendFormat(" document.getElementById('{0}').focus();", txtDescCartMod.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendLine(" return true;"); sScript.AppendLine("}"); ClientScript.RegisterStartupScript(Page.GetType(), "__ScriptCliente__", sScript.ToString(), true); } }
protected void Submit_Click(object sender, EventArgs e) { string errors = string.Empty; if (ServerValidate(ref errors)) { FormToDataBind(); if (string.IsNullOrEmpty(PaymentToApprovalHiddenID.Value)) { objApproval.ApprovalManagementInsert(); } else { objApproval.ApprovalManagementUpdate(); } Response.Redirect(string.Format("ApprovalAdministration.aspx?PaymentID={0}", PaymentHiddenID.Value)); } else { if (!ClientScript.IsClientScriptBlockRegistered("ValidationFailure")) { ClientScript.RegisterClientScriptBlock(GetType(), "ValidationFailure", "<script type='text/javascript'>alert('" + errors.Replace("'", "").Replace("<br />", "\\n") + "');</script>", false); } } }
protected void Submit_Click(object sender, EventArgs e) { string errors = string.Empty; if (ServerValidate(ref errors)) { FormToDataBind(); if (string.IsNullOrEmpty(RevenueEntryTypeID.Value)) { objRevenueEntryType.RevenueEntryTypeInsert(); } else { objRevenueEntryType.RevenueEntryTypeUpdate(); } Response.Redirect("RevenueEntryTypeProfile.aspx?RevenueEntryTypeID=" + objRevenueEntryType.RevenueEntryTypeID); } else { ErrorMessage.Visible = true; ErrorMessage.Text = errors; if (!ClientScript.IsClientScriptBlockRegistered("ValidationFailure")) { ClientScript.RegisterClientScriptBlock(GetType(), "ValidationFailure", "<script type='text/javascript'>alert('" + errors.Replace("'", "").Replace("<br />", "\\n") + "');</script>", false); } } }
protected void Submit_Click(object sender, EventArgs e) { string errors = string.Empty; if (ServerValidate(ref errors)) { FormToDataBind(); if (string.IsNullOrEmpty(BonusPlanHiddenID.Value)) { objBonusPlan.BonusPlanInsert(); } else { objBonusPlan.BonusPlanUpdate(); } Response.Redirect(string.Format("BonusPlanProfile.aspx?BonusPlanID={0}", BonusPlanHiddenID.Value)); } else { if (!ClientScript.IsClientScriptBlockRegistered("ValidationFailure")) { ClientScript.RegisterClientScriptBlock(GetType(), "ValidationFailure", "<script type='text/javascript'>alert('" + errors.Replace("'", "").Replace("<br />", "\\n") + "');</script>", false); } } }
/// <summary> /// Evento Load. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { cFormLogin objUILogin = new cFormLogin(); if (!IsPostBack) { try { //Recupera el Tipo de Seguridad y nombre de Dominio para Mostrar. HttpContext.Current.Session["objCipol"] = new EntidadesEmpresariales.PadreCipolCliente(); this.lblNombreDominio.Text = objUILogin.RecuperarTipoSeguridadYNombreDeDominio(new System.Net.CookieContainer()); // [IvanSa] Se registra la funcion de Jquery para obtener el ip del cliente. if (System.Configuration.ConfigurationManager.AppSettings["EnviarDireccionIP"] == "S" && System.Configuration.ConfigurationManager.AppSettings["ServicioPublicoIP"] == "S") { string script = string.Format("ObtenerIP();"); if (!ClientScript.IsClientScriptBlockRegistered("myScript")) { ClientScript.RegisterClientScriptBlock(typeof(frmLogin), "myScript", script, true); } } } catch (Exception) { //TODO MOSTRAR ERROR throw; } } }
protected void _FecharCadastro() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type=\"text/javascript\">"); sb.Append("\r\n"); sb.Append("if (parent != undefined) {"); sb.Append("\r\n"); sb.Append(String.Format("\tparent.fecharBusca('#ifrm{0}');", Request["buscaID"])); sb.Append("\r\n"); sb.Append("}"); sb.Append("\r\n"); sb.Append("</script>"); var scriptManager = ScriptManager.GetCurrent(Page); if (scriptManager != null && scriptManager.IsInAsyncPostBack) { ScriptManager.RegisterClientScriptBlock(Page, typeof(Page), Request["buscaID"], sb.ToString(), false); } else { if (!ClientScript.IsClientScriptBlockRegistered(Request["buscaID"])) { ClientScript.RegisterClientScriptBlock(typeof(Page), Request["buscaID"], sb.ToString()); } } }
protected void grdImportDetails_ItemCommand(object source, Telerik.WebControls.GridCommandEventArgs e) { try { if (e.CommandName == "UpdateAll") { List <ImportDetails> imList = new List <ImportDetails>(); //First store modifications made in this page to the dataset StoreValuesToDataSet(); //populate list for modified or deleted rows PopulateImportDetailsList(imList); //send modifications to the DB image of the import ImportDetails importDetails = new ImportDetails(CurrentConnectionManager); DataSet dsNewCreatedFile = importDetails.UpdateBatchImportDetails(imList, IdImport); //create new file with current state of import bool result = CreateNewFile(dsNewCreatedFile); if (result) { if (!Page.ClientScript.IsClientScriptBlockRegistered(this.Page.GetType(), "ButtonUpdateClick")) { Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "ButtonUpdateClick", "window.returnValue = 1; window.close();", true); } } else { //After saving, if something went wrong re-load the grid DsLogs = null; LoadEditableGrid(); } } //When changing the page, we need to store any possible modifications made to the current page in the underlying datasource of the //grid if (e.CommandName == "Page") { StoreValuesToDataSet(); } } catch (IndException indExc) { SaveSuccessful = false; ShowError(indExc); } catch (Exception exc) { SaveSuccessful = false; ShowError(new IndException(exc)); } finally { if (!ClientScript.IsClientScriptBlockRegistered(this.GetType(), "ResizePopUp")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "ResizePopUp", "SetPopUpHeight();", true); } } }
protected void gdvTraineeList_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "View") { StringBuilder sb = new StringBuilder(); sb.Append("<script language='javascript'>"); sb.Append("window.open('../Admin/frmTrainingEmployeeReport.aspx?TrainingId=" + e.CommandArgument.ToString() + "','CustomPop','height=500,width=900');"); sb.Append("</script>"); Type t = this.GetType(); if (!ClientScript.IsClientScriptBlockRegistered(t, "PopupScript")) { ClientScript.RegisterClientScriptBlock(t, "PopupScript", sb.ToString()); } } else if (e.CommandName == "Edit") { //Response.Redirect("frmEmployeeTraining.aspx?TrainingId=" + e.CommandArgument.ToString(), false); gdvTraineeList.EditIndex = -1; BindTrainingList(); } else { _objTrainingMaster.TrainingId = Convert.ToInt32(e.CommandArgument.ToString()); foreach (ErrorHandlerClass err in _objTrainingMasterManager.DeleteTrainingMaster(_objTrainingMaster)) { if (err.Type == "E") { lblMsg.ForeColor = Color.Red; lblMsg.Text = err.Message.ToString(); break; } else if (err.Type == "A") { lblMsg.ForeColor = Color.Red; lblMsg.Text = err.Message.ToString(); break; } else { if (lblMsg.Text.ToString() == "") { lblMsg.ForeColor = Color.Green; lblMsg.Text = err.Message.ToString(); gdvTraineeList.EditIndex = -1; BindTrainingList(); } } } } } catch (Exception ee) { lblMsg.Text = ee.StackTrace; lblMsg.ForeColor = Color.Red; } }
void errormessage2(String errMsg) { if (!ClientScript.IsClientScriptBlockRegistered("_errorMessage")) { ClientScript.RegisterClientScriptBlock(typeof(Page), "_errorMessage", "alert('" + errMsg + "') ;", true); } lbl_error2.Text = errMsg.Replace("\\n", "<br/>"); MultiView1.SetActiveView(view_main2); }
private void CloseWindow() { if (!ClientScript.IsClientScriptBlockRegistered("CloseWindow")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "CloseWindow", "<script type='text/javascript'> window.close(); </script>"); } }
private void ScriptCliente() { if (!ClientScript.IsClientScriptBlockRegistered("__ScriptCliente__")) { StringBuilder sScript = new StringBuilder(); sScript.AppendLine(""); sScript.AppendLine("function IsValid()"); sScript.AppendLine("{"); sScript.AppendFormat(" msg = '{0}';", Resources.Mensajes.msgConfirmación); sScript.AppendFormat(" strDescripcion = document.getElementById('{0}').value;", txtDescripcion.ClientID); sScript.AppendLine(" if (strDescripcion.length == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgPromocionAlertNombNoIngresado); sScript.AppendFormat(" document.getElementById('{0}').focus();", txtDescripcion.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendLine(" if (strDescripcion.length > 100)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgPromocionAlertNombNoIngresado); sScript.AppendFormat(" document.getElementById('{0}').focus();", txtDescripcion.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendFormat(" return confirm(msg);"); sScript.AppendLine("}"); sScript.AppendLine("function confirmacion(strMsje)"); sScript.AppendLine("{"); sScript.AppendFormat(" return confirm(strMsje);"); sScript.AppendLine("}"); sScript.AppendLine("function confirmEliminacion(strMsje)"); sScript.AppendLine("{"); sScript.AppendFormat(" return confirm(strMsje);"); sScript.AppendLine("}"); sScript.AppendLine("function Agregar()"); sScript.AppendLine("{"); sScript.AppendFormat("document.getElementById('{0}').style.visibility = 'visible';", pnlDetalle.ClientID); sScript.AppendFormat("document.getElementById('{0}').value='';", txtDescripcion.ClientID); sScript.AppendFormat("document.getElementById('{0}').value='';", hidId.ClientID); sScript.AppendFormat("document.getElementById('{0}').focus();", txtDescripcion.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine("}"); sScript.AppendLine("function Limpiar()"); sScript.AppendLine("{"); sScript.AppendFormat("document.getElementById('{0}').value='';", txtDescripcion.ClientID); sScript.AppendFormat("document.getElementById('{0}').value='';", hidId.ClientID); sScript.AppendFormat("document.getElementById('{0}').style.visibility = 'hidden';", pnlDetalle.ClientID); sScript.AppendLine(" return true;"); sScript.AppendLine("}"); ClientScript.RegisterStartupScript(Page.GetType(), "__ScriptCliente__", sScript.ToString(), true); } }
protected void ActualizaWebPadre(bool habilita) { string webPadreScript = "<script language='JavaScript'>" + "HabilitaBotonSiguiente(" + (habilita ? "false" : "true") + ")</script>"; if (!ClientScript.IsClientScriptBlockRegistered("WebPadreScript")) { ClientScript.RegisterStartupScript(this.GetType(), "WebPadreScript", webPadreScript, false); } }
protected void btnPreview_Click1(object sender, EventArgs e) { string url = "../../Products.aspx"; string script = "window.open('" + url + "','')"; if (!ClientScript.IsClientScriptBlockRegistered("NewWindow")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "NewWindow", script, true); } }
protected void ButtonGoToPrintPage_Click(object sender, EventArgs e) { if (formViewEmployee.CurrentMode != FormViewMode.Insert) { string script = "window.open('print-page.aspx','')"; if (!ClientScript.IsClientScriptBlockRegistered("NewWindow")) { ClientScript.RegisterClientScriptBlock(this.GetType(), "NewWindow", script, true); } } }
private void MessageBox(string strKey, string strInfo) { if (!ClientScript.IsClientScriptBlockRegistered(strKey)) { string strjs = "function window.onload(){alert('" + strInfo + "');}"; //window.location='happytalk.aspx';这句大家可以去掉,我是用来重定向的,效果不好。 ClientScript.RegisterClientScriptBlock(this.GetType(), strKey, strjs, true); } }
protected void Page_Load(object sender, EventArgs e) { bool cancel = new tools().SessionCheck(Session); if (cancel) { Response.Redirect("Default.aspx"); } int aid = int.Parse(Session[constants.SESSION_MODE_SEND_AID].ToString()); dataaccess da = new dataaccess(); _hasData = da.GetAlertClassAndStudentsByAlertId(aid); labelClassId.Text = _hasData._class[0].id.ToString(); labelClassnumber.Text = _hasData._class[0].classnumber.ToString(); this.RepeaterStudents.DataSource = _hasData.student; this.RepeaterStudents.DataBind(); this.imageButtonSend.ToolTip = "Start Sending Alerts"; if (Session[constants.SESSION_MODE].ToString() == constants.SESSION_MODE_SENDING) { tools t = new tools(); alertprogress ap = (alertprogress)Session[constants.SESSION_MODE_SENDING_PROGRESS]; this.imageButtonSend.ImageUrl = "~/img/sending.gif"; this.imageButtonSend.ToolTip = "Sending Alerts~ (Please Wait)"; this.SetRepeaterStatuses(ap); //Verify script isn't already registered if (!ClientScript.IsClientScriptBlockRegistered("waitScript")) { string js = "\n<script type=\"text/javascript\" language=\"Javascript\" id=\"waitScript\">\n"; js += "wait(2000);"; js += "\n\n </script>"; ClientScript.RegisterClientScriptBlock(this.GetType(), "waitScript", js); } t.Alerting(Session, ap); } if (Session[constants.SESSION_MODE].ToString() == constants.SESSION_MODE_SENDING_FINISHED) { alertprogress ap = (alertprogress)Session[constants.SESSION_MODE_SENDING_PROGRESS]; this.imageButtonSend.ImageUrl = "~/img/ok.png"; this.imageButtonSend.ToolTip = "Finished Sending! Click to return to class~ ^^"; this.SetRepeaterStatuses(ap); da.UpdateAlertStatus(aid); } }
private void AppendJqeryScriptForTable() { //registra in fondo alla pagina lo script js per le funzionalità jquery della tabella System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(@"<script language='javascript'>"); sb.Append(@"$(document).ready(function() { $('#dataTables-example').DataTable({responsive: true});});"); sb.Append(@"</script>"); if (!ClientScript.IsClientScriptBlockRegistered("JSScriptBlock")) { ClientScript.RegisterStartupScript(this.GetType(), "JSScriptBlock", sb.ToString()); } }
protected void grdvAdj_RowCommand(object sender, GridViewCommandEventArgs e) { lbl_error.Text = ""; if (e.CommandName.Equals("Select")) { frmAddAdj.Visible = false; frmEditAdj.Visible = true; if (!ClientScript.IsClientScriptBlockRegistered("ScrollInto")) { ClientScript.RegisterClientScriptBlock(typeof(Page), "ScrollInto", "ScrollInto('" + frmEditAdj.ClientID + "');", true); } } }
protected void btnSave_Click(object sender, EventArgs e) { string idPerson = this.FormContext.QueryString["idResource"].ToString(); foreach (GridViewRow row in this.gvUploadedFiles.Rows) { if (row.RowType == DataControlRowType.DataRow) { //ID на прикачени файл HiddenField hdnRowMasterKey = row.FindControl("hdnIdUploadedFile") as HiddenField; //radio button RadioButton rbtn = row.FindControl("rbtnSelectedFile") as RadioButton; //описание за всеки прикачен файл TextBox tbxDescription = row.Cells[0].FindControl("tbxDescription") as TextBox; string descr = tbxDescription.Text; //Update на всички редове като записваме само описанието this.currentEntity = CommonClientRef.GetUploadFileByID(hdnRowMasterKey.Value); currentEntity.Description = descr; CallContext resultContext = new CallContext(); resultContext.CurrentConsumerID = this.UserProps.IdUser; resultContext = CommonClientRef.UploadedFileSave(currentEntity, resultContext); //update на снимката на потребителя if (rbtn.Checked) { this.personEntity = this.AdminClientRef.GetPersonByPersonID(idPerson); if (this.personEntity != null) { this.personEntity.ImagePath = this.currentEntity.FilePath.Replace("\\", "/").Replace("C:", string.Empty); CallContext resultPersontContext = new CallContext(); resultPersontContext.CurrentConsumerID = this.UserProps.IdUser; resultPersontContext = AdminClientRef.PersonSave(this.personEntity, resultPersontContext); } //refresh Parent form string script = "this.window.opener.location=this.window.opener.location;"; if (!ClientScript.IsClientScriptBlockRegistered("REFRESH_PARENT")) { ClientScript.RegisterClientScriptBlock(typeof(string), "REFRESH_PARENT", script, true); } } } } }
private void ScriptCliente() { if (!ClientScript.IsClientScriptBlockRegistered("__ScriptCliente__")) { StringBuilder sScript = new StringBuilder(); sScript.AppendLine(""); sScript.AppendLine("function IsSelected()"); sScript.AppendLine("{"); sScript.AppendFormat(" msg = '{0}';", Resources.Mensajes.msgConfirmación); sScript.AppendFormat(" strSelCategoria = document.getElementById('{0}').value;", cboCategoria.ClientID); sScript.AppendFormat(" strSelPromocion = document.getElementById('{0}').value;", cboPromocion.ClientID); sScript.AppendLine(" if (strSelCategoria == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgCCCPNoSelCategoria); sScript.AppendFormat(" document.getElementById('{0}').focus();", cboCategoria.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendLine(" if (strSelPromocion == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgCCCPNoSelPromocion); sScript.AppendFormat(" document.getElementById('{0}').focus();", cboPromocion.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendLine(" return true;"); sScript.AppendLine("}"); sScript.AppendLine("function IsValid()"); sScript.AppendLine("{"); sScript.AppendFormat(" msg = '{0}';", Resources.Mensajes.msgConfirmación); sScript.AppendFormat(" strCartelModelo = document.getElementById('{0}').value;", cboCartelModelo.ClientID); sScript.AppendLine(" if (strCartelModelo == 0)"); sScript.AppendLine(" {"); sScript.AppendFormat(" alert('{0}');", Resources.Mensajes.msgCCCPNoSelCarModel); sScript.AppendFormat(" document.getElementById('{0}').focus();", cboCartelModelo.ClientID); sScript.AppendLine(" return false;"); sScript.AppendLine(" }"); sScript.AppendFormat(" return confirm(msg);"); sScript.AppendLine("}"); sScript.AppendLine("function confirmEliminacion(strMsje)"); sScript.AppendLine("{"); sScript.AppendFormat(" return confirm(strMsje);"); sScript.AppendLine("}"); ClientScript.RegisterStartupScript(Page.GetType(), "__ScriptCliente__", sScript.ToString(), true); } }
protected void btnNewAdj_Click(object sender, EventArgs e) { lbl_error1.Text = ""; lbl_error.Text = ""; frmEditAdj.Visible = false; frmAddAdj.Visible = true; ((TextBox)frmAddAdj.FindControl("txtAYRMO")).Text = ddlYrmo.SelectedItem.Text; ((DropDownList)frmAddAdj.FindControl("ddlAProgcd")).SelectedIndex = ddlProgcd.SelectedIndex; ((DropDownList)frmAddAdj.FindControl("ddlAHMO")).SelectedIndex = ddlHMO.SelectedIndex; if (!ClientScript.IsClientScriptBlockRegistered("ScrollInto")) { ClientScript.RegisterClientScriptBlock(typeof(Page), "ScrollInto", "ScrollInto('" + frmAddAdj.ClientID + "');", true); } }
/// <summary> /// Handles the Load event of the Page control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param> private void Page_Load(object sender, EventArgs e) { // Form the script that is to be registered at client side. string scriptString = "<script language=JavaScript>function newWindow(file,window) {"; scriptString += "msgWindow=open(file,window,'resizable=yes,width=600,height=500,scrollbars=yes');"; scriptString += "if (msgWindow.opener == null) msgWindow.opener = self;"; scriptString += "}</script>"; if (!ClientScript.IsClientScriptBlockRegistered("newWindow")) { ClientScript.RegisterClientScriptBlock(GetType(), "newWindow", scriptString); } showGalleryButton.NavigateUrl = "javascript:newWindow('UploadFlash.aspx?FieldID=Src&mID=" + ModuleID + "','gallery')"; if (Page.IsPostBack == false) { if (ModuleID > 0) { Hashtable settings; // Get settings from the database settings = ModuleSettings.GetModuleSettings(ModuleID); if (settings["src"] != null) { Src.Text = settings["src"].ToString(); } if (settings["width"] != null) { Width.Text = settings["width"].ToString(); } if (settings["height"] != null) { Height.Text = settings["height"].ToString(); } if (settings["backcolor"] != null) { BackgroundCol.Text = settings["backcolor"].ToString(); } } // Store URL Referrer to return to portal ViewState["UrlReferrer"] = Request.UrlReferrer.ToString(); } }