protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.User.Identity.Name == "")
     {
         Response.Redirect("../Login.aspx");
     }
     if (!IsPostBack)
     {
         try
         {
             Tz888.SQLServerDAL.TPMerchant objtp = new Tz888.SQLServerDAL.TPMerchant();
             string  infoid = Request.QueryString["id"].ToString();
             DataSet ds     = objtp.GetOneNewsList(infoid);
             this.txtTitle.Value           = ds.Tables[0].Rows[0]["Title"].ToString();
             this.txtContent.Value         = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["Content"].ToString());
             this.txtInstruction.Value     = ds.Tables[0].Rows[0]["PicAbout"].ToString();
             this.txtSource.Value          = ds.Tables[0].Rows[0]["Origin"].ToString();
             ZoneSelectControl1.ProvinceID = ds.Tables[0].Rows[0]["ProvinceID"].ToString().Trim();
             ZoneSelectControl1.CityID     = ds.Tables[0].Rows[0]["CityID"].ToString().Trim();
             ZoneSelectControl1.CountyID   = ds.Tables[0].Rows[0]["CountyID"].ToString().Trim();
             string strNewsType = "radioType" + ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim();
             ViewState["NewsType"] = ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim();
             System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.tbNews.FindControl(strNewsType);
             if (obj != null)
             {
                 obj.Checked = true;
             }
         }
         catch
         {
             Response.Write("<script>alert('请重新选择要修改的数据!');window.close();</script>");
         }
     }
 }
Exemple #2
0
		protected override void OnInit(EventArgs e)
		{
			base.OnInit(e);

			var panel = new Panel();
			panel.HorizontalAlign = HorizontalAlign.Center;
			panel.Controls.Add(new Label() { Text = "Past"});
			this.uiShowPast = new HtmlInputRadioButton()
			{
				ID = "uiShowPast",
				Name = "EventPeriod"
			};
			panel.Controls.Add(this.uiShowPast);
			panel.Controls.Add(new Label() { Text = "Future" });
			this.uiShowFuture = new HtmlInputRadioButton()
			{
				ID = "uiShowFuture",
				Name = "EventPeriod",
				Checked = true
			};
			panel.Controls.Add(this.uiShowFuture);
			panel.Controls.Add(new Label() { Width = new Unit(20, UnitType.Pixel) });
			panel.Controls.Add(new Label() { Text = "Music type " });
			this.uiMusicType = new DropDownList();
			this.uiMusicType.ID = "uiMusicType";
			uiMusicType.Items.AddRange(Bobs.MusicType.MusicTypes.Select(mt => new ListItem(mt.Key, mt.Value.ToString())).ToArray());
			panel.Controls.Add(uiMusicType);
			this.Controls.Add(panel);
		}
Exemple #3
0
        protected void FormGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            switch (e.Row.RowType)
            {
                case DataControlRowType.DataRow:
                    using (var radio = new HtmlInputRadioButton())
                    {
                        radio.ClientIDMode = ClientIDMode.Static;
                        radio.Name = "SelectRadio";
                        radio.ID = "SelectRadio";
                        radio.ClientIDMode = ClientIDMode.Predictable;
                        radio.Value = e.Row.Cells[1].Text;
                        //radio.Attributes.Add("onclick", "scrudSelectRadioById(this.id);");
                        e.Row.Cells[0].Controls.Add(radio);
                    }
                    break;

                case DataControlRowType.Header:
                    for (var i = 1; i < e.Row.Cells.Count; i++)
                    {
                        var cellText = e.Row.Cells[i].Text;

                        cellText = LocalizationHelper.GetResourceString(this.GetResourceClassName(), cellText);
                        e.Row.Cells[i].Text = cellText;
                    }
                    break;
            }
        }
Exemple #4
0
        protected void FormGridView_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e == null)
            {
                return;
            }

            if(e.Row.RowType == DataControlRowType.DataRow)
            {
                using (HtmlInputRadioButton radio = new HtmlInputRadioButton())
                {
                    radio.ClientIDMode = System.Web.UI.ClientIDMode.Static;
                    radio.Name = "SelectRadio";
                    radio.ID = "SelectRadio";
                    radio.ClientIDMode = System.Web.UI.ClientIDMode.Predictable;
                    radio.Value = e.Row.Cells[1].Text;
                    //radio.Attributes.Add("onclick", "selectNode(this.id);");
                    e.Row.Cells[0].Controls.Add(radio);
                }
            }
            else if(e.Row.RowType == DataControlRowType.Header)
            {
                for(int i = 1; i < e.Row.Cells.Count; i++)
                {
                    string cellText = e.Row.Cells[i].Text;

                    cellText = MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", cellText);
                    e.Row.Cells[i].Text = cellText;
                }
            }
        }
		public void NullProperties ()
		{
			HtmlInputRadioButton rb = new HtmlInputRadioButton ();
			rb.Name = null;
			Assert.AreEqual (String.Empty, rb.Name, "Name");
			rb.Value = null;
			Assert.IsNull (rb.Value, "Value");

			Assert.AreEqual (defaultAttributesCount, rb.Attributes.Count, "Attributes.Count");
		}
Exemple #6
0
        public int userid; //用户ID

        #endregion Fields

        #region Methods

        protected void Bind(int id)
        {
            lb_ID.Text = id.ToString();
            CY.GFive.Core.Business.Vote vote = CY.GFive.Core.Business.Vote.Load(id);
            lb_VoteName.Text = vote.VoteTitle;
            IList<CY.GFive.Core.Business.VoteItem> itemlist = CY.GFive.Core.Business.VoteItem.GetVoteItemByVoteID(id);
            int Anscount = 0;
            for (int i = 0; i < itemlist.Count; i++)
            {

                lb_Title.Controls.Add(new LiteralControl("<p>"));
                lb_Title.Controls.Add(new LiteralControl(itemlist[i].VoteItemContent));
                if (itemlist[i].IsMutiChoose == 1)
                { lb_Title.Controls.Add(new LiteralControl("(多选):")); }
                else { lb_Title.Controls.Add(new LiteralControl(":")); }
                lb_Title.Controls.Add(new LiteralControl("</p>"));
                lb_Title.Controls.Add(new LiteralControl("<p>"));
                IList<CY.GFive.Core.Business.VoteAnswer> answerlist = CY.GFive.Core.Business.VoteAnswer.GetVoteAnswerByVoteItemID(itemlist[i].Id);
                lb_ItemCount.Text = itemlist[i].Id.ToString();
                for (int j = 0; j < answerlist.Count; j++)
                {
                    if (itemlist[i].IsMutiChoose == 0)
                    {
                        HtmlInputRadioButton rb1 = new HtmlInputRadioButton();
                        rb1.ID = answerlist[j].Id.ToString();
                        rb1.Attributes.Add("runat", "server");
                        rb1.Name = "rb_" + itemlist[i].Id;
                        lb_Title.Controls.Add(rb1);
                        lb_Title.Controls.Add(new LiteralControl(answerlist[j].VoteAnswerContent + "&nbsp;&nbsp;&nbsp;&nbsp;"));
                        if (Anscount <= answerlist[j].Id)
                        { Anscount = answerlist[j].Id; }
                    }
                    if (itemlist[i].IsMutiChoose == 1)
                    {
                        HtmlInputCheckBox cb1 = new HtmlInputCheckBox();
                        cb1.ID = "cb_" + itemlist[i].Id + "_" + answerlist[j].Id.ToString();
                        cb1.Attributes.Add("runat", "server");
                        lb_Title.Controls.Add(cb1);
                        lb_Title.Controls.Add(new LiteralControl(answerlist[j].VoteAnswerContent + "&nbsp;&nbsp;&nbsp;&nbsp;"));
                        if (Anscount <= answerlist[j].Id)
                        { Anscount = answerlist[j].Id; }
                    }
                }
                if (itemlist[i].IsUserDefine == 1)
                {
                    lb_Title.Controls.Add(new LiteralControl("其它答案"));
                    HtmlInputText tb1 = new HtmlInputText();
                    tb1.ID = "tb_" + itemlist[i].Id.ToString();
                    lb_Title.Controls.Add(tb1);
                }
                lb_Title.Controls.Add(new LiteralControl("<p>"));
            }
            lb_anscount.Text = Anscount.ToString();
        }
		public void DefaultProperties ()
		{
			HtmlInputRadioButton rb = new HtmlInputRadioButton ();
			Assert.AreEqual (defaultAttributesCount, rb.Attributes.Count, "Attributes.Count");

			Assert.IsFalse (rb.Checked, "Checked");
			Assert.AreEqual (String.Empty, rb.Name, "Name");
			Assert.IsNull (rb.Value, "Value");

			Assert.AreEqual ("input", rb.TagName, "TagName");
			Assert.AreEqual (defaultAttributesCount, rb.Attributes.Count, "Attributes.Count-2");
		}
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Page.User.Identity.Name == "")
        {
            Response.Redirect("../Login.aspx");
        }

        if (!IsPostBack)
        {
            //ViewState["strSavePath"] = "UploadVideo/y/";
            ViewState["strSavePath"] = "UploadVideo/" + Page.User.Identity.Name + "/";
            try
            {
                Tz888.SQLServerDAL.TPVideo objtp = new Tz888.SQLServerDAL.TPVideo();
                string  infoid = Request.QueryString["id"].ToString();
                DataSet ds     = objtp.GetOneVideoMess(infoid);
                this.txtTitle.Value   = ds.Tables[0].Rows[0]["subTitle"].ToString();
                this.txtContent.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["Content"].ToString());
                this.txtAuthor.Value  = ds.Tables[0].Rows[0]["Author"].ToString();
                this.txtKeyWord.Value = ds.Tables[0].Rows[0]["KeyWord"].ToString();
                string strOrigin = ds.Tables[0].Rows[0]["Origin"].ToString().Trim();
                ZoneSelectControl1.ProvinceID = ds.Tables[0].Rows[0]["ProvinceID"].ToString().Trim();
                ZoneSelectControl1.CityID     = ds.Tables[0].Rows[0]["CityID"].ToString().Trim();
                ZoneSelectControl1.CountyID   = ds.Tables[0].Rows[0]["CountyID"].ToString().Trim();
                switch (strOrigin)
                {
                case "转载":
                    System.Web.UI.HtmlControls.HtmlInputRadioButton obj1 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl("radioType1");
                    if (obj1 != null)
                    {
                        obj1.Checked = true;
                    }
                    break;

                case "原创":
                    System.Web.UI.HtmlControls.HtmlInputRadioButton obj2 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl("radioType2");
                    if (obj2 != null)
                    {
                        obj2.Checked = true;
                    }
                    break;

                default:
                    break;
                }
            }
            catch
            {
                Response.Write("<script>alert('请重新选择要修改的数据!'); window.close();</script>");
            }
        }
        this.BtnAddVideo.Attributes.Add("onclick", "return chkInput();");
    }
Exemple #9
0
 public void Render(ref System.Web.UI.WebControls.WebControl owner, ref TreeView treeView, int level, ref int currentNodeId, bool lastItem, string parentBorder)
 {
     currentNodeId += 1;
      Table NodeTable = new Table();
      TableRow NodeRow = new TableRow();
      TableCell TextCell = new TableCell();
      NodeTable.CellPadding = 0;
      NodeTable.CellSpacing = 0;
      if (parentBorder.Length > 0)
      {
     TableCell ParentBorderCell = new TableCell();
     Label ParentBorderLabel = new Label();
     ParentBorderLabel.Text = parentBorder;
     ParentBorderCell.Controls.Add(ParentBorderLabel);
     NodeRow.Controls.Add(ParentBorderCell);
      }
      if (lastItem)
      {
     parentBorder += "<img src='" + treeView.ImagesFolder + "blank-node.gif'>";
      }
      else
      {
     parentBorder += "<img src='" + treeView.ImagesFolder + "edge-node.gif'>";
      }
      TableCell ExpandImageCell = new TableCell();
      RenderExpandImage(ExpandImageCell, ref treeView, lastItem, currentNodeId);
      NodeRow.Controls.Add(ExpandImageCell);
      if (this.Selector != SelectionMode.None)
      {
     TableCell SelectorCell = new TableCell();
     if (this.Selector == SelectionMode.CheckBox)
     {
        HtmlInputCheckBox CBox = new HtmlInputCheckBox();
        CBox.Style.Add("height", "14");
        CBox.Style.Add("width", "14");
        CBox.ID = treeView.UniqueID + "_selected";
        CBox.Checked = this.Selected;
        CBox.Value = currentNodeId.ToString();
        SelectorCell.Controls.Add(CBox);
     }
     else if (this.Selector == SelectionMode.RadioButton)
     {
        HtmlInputRadioButton RButton = new HtmlInputRadioButton();
        RButton.Style.Add("height", "15");
        RButton.Style.Add("width", "15");
        RButton.ID = treeView.UniqueID + "_selected";
        RButton.Checked = this.Selected;
        RButton.Value = currentNodeId.ToString();
        SelectorCell.Controls.Add(RButton);
     }
     NodeRow.Controls.Add(SelectorCell);
      }
      if (Image.Length > 0)
      {
     TableCell ImageCell = new TableCell();
     TableCell SpaceCell = new TableCell();
     System.Web.UI.HtmlControls.HtmlImage NodeImage = new System.Web.UI.HtmlControls.HtmlImage();
     NodeImage.Src = Image;
     NodeImage.Border = 0;
     NodeImage.Attributes.Add("align", "absmiddle");
     Label SpaceLabel = new Label();
     SpaceLabel.Text = "&nbsp;";
     SpaceCell.Controls.Add(SpaceLabel);
     if (Link.Length > 0)
     {
        HtmlAnchor a = CreateLink(treeView);
        a.Controls.Add(NodeImage);
        ImageCell.Controls.Add(a);
     }
     else
     {
        ImageCell.Controls.Add(NodeImage);
        ImageCell.Attributes.Add("onClick", treeView.GetPostBackClientEvent("C" + currentNodeId.ToString()));
     }
     NodeRow.Controls.Add(ImageCell);
     NodeRow.Controls.Add(SpaceCell);
      }
      Label TextLabel = new Label();
      TextLabel.Text = Text;
      TextCell.HorizontalAlign = HorizontalAlign.Left;
      TextCell.Wrap = false;
      if (Link.Length  > 0)
      {
     HtmlAnchor a = CreateLink(treeView);
     a.Controls.Add(TextLabel);
     TextCell.Controls.Add(a);
      }
      else
      {
     TextLabel.Style.Add("cursor", "hand");
     TextCell.Controls.Add(TextLabel);
     TextCell.Attributes.Add( "onClick", treeView.GetPostBackClientEvent("C" + currentNodeId.ToString()) );
      }
      NodeRow.Controls.Add(TextCell);
      NodeTable.Controls.Add(NodeRow);
      owner.Controls.Add(NodeTable);
      if (this.Items.Count > 0 & this.Open)
      {
     Items.Render(ref owner, ref treeView, level + 1, ref currentNodeId, parentBorder);
      }
 }
Exemple #10
0
		/// <summary>
		/// Sets the value of the given selector to the row index.
		/// </summary>
		protected virtual void SetIndexValue( HtmlInputRadioButton radioSelector ) 
		{
			DataGridItem row = radioSelector.NamingContainer as DataGridItem;
			if ( row != null ) 
			{
				radioSelector.Value = row.ItemIndex.ToString();
			}
		}
Exemple #11
0
    /// <summary>
    /// Request Object Form Value
    /// </summary>
    /// <param name="FormObject">WebControls, HtmlControls</param>
    /// <param name="sDefaultValue"></param>
    /// <returns>String</returns>
    public static string rf(object FormObject, string sDefaultValue = null)
    {
        string sRet = sDefaultValue;

        if (FormObject != null)
        {
            try
            {
                TextBox obj = (TextBox)FormObject;
                sRet = obj.Text;
            }
            catch { }
            finally { }
            try
            {
                System.Web.UI.HtmlControls.HtmlInputText obj = (System.Web.UI.HtmlControls.HtmlInputText)FormObject;
                sRet = obj.Value;
            }
            catch { }
            try
            {
                System.Web.UI.HtmlControls.HtmlInputHidden obj = (System.Web.UI.HtmlControls.HtmlInputHidden)FormObject;
                sRet = obj.Value;
            }
            catch { }
            try
            {
                System.Web.UI.HtmlControls.HtmlTextArea obj = (System.Web.UI.HtmlControls.HtmlTextArea)FormObject;
                sRet = obj.InnerText;
            }
            catch { }
            try
            {
                DropDownList obj = (DropDownList)FormObject;
                sRet = obj.SelectedItem.Value;
            }
            catch { }
            try
            {
                System.Web.UI.HtmlControls.HtmlSelect obj = (System.Web.UI.HtmlControls.HtmlSelect)FormObject;
                sRet = obj.Value;
            }
            catch { }
            try
            {
                RadioButtonList obj = (RadioButtonList)FormObject;
                sRet = obj.SelectedItem.Value;
            }
            catch { }
            try
            {
                System.Web.UI.HtmlControls.HtmlInputCheckBox obj = (System.Web.UI.HtmlControls.HtmlInputCheckBox)FormObject;
                sRet = obj.Value;
            }
            catch { }
            try
            {
                System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton)FormObject;
                sRet = obj.Value;
            }
            catch { }
        }
        return(sRet);
    }
Exemple #12
0
    protected void btn_submit_Click(object sender, EventArgs e)
    {
        if (string.Compare(rc_type.SelectedValue, "Trainer", true) == 0 && rc_Trainer.SelectedIndex <= 0)
        {
            BLL.ShowMessage(this, "Please select Trainer");
            return;
        }

        DataTable            dtFeedBackTable        = GetFeedbackRatingTable();
        SMHR_FEEDBACK_RATING _obj_SMHR_QuestionBank = new SMHR_FEEDBACK_RATING();

        try
        {
            System.Web.UI.HtmlControls.HtmlInputRadioButton rad_IsActive; int qtnid;
            bool isChecked = false;
            for (int index = 0; index < RG_TrainingApproval.Items.Count; index++)
            {
                qtnid        = Convert.ToInt32(RG_TrainingApproval.Items[index].Cells[2].Text);
                rad_IsActive = new System.Web.UI.HtmlControls.HtmlInputRadioButton();
                rad_IsActive = RG_TrainingApproval.Items[index].FindControl("rbn_Rate1") as System.Web.UI.HtmlControls.HtmlInputRadioButton;
                if (rad_IsActive.Checked)
                {
                    isChecked = true;
                    _obj_SMHR_QuestionBank.RATING_RATING = Convert.ToInt32(rad_IsActive.Value);
                }
                rad_IsActive = new System.Web.UI.HtmlControls.HtmlInputRadioButton();
                rad_IsActive = RG_TrainingApproval.Items[index].FindControl("rbn_Rate2") as System.Web.UI.HtmlControls.HtmlInputRadioButton;
                if (rad_IsActive.Checked)
                {
                    isChecked = true;
                    _obj_SMHR_QuestionBank.RATING_RATING = Convert.ToInt32(rad_IsActive.Value);
                }
                rad_IsActive = new System.Web.UI.HtmlControls.HtmlInputRadioButton();
                rad_IsActive = RG_TrainingApproval.Items[index].FindControl("rbn_Rate3") as System.Web.UI.HtmlControls.HtmlInputRadioButton;
                if (rad_IsActive.Checked)
                {
                    isChecked = true;
                    _obj_SMHR_QuestionBank.RATING_RATING = Convert.ToInt32(rad_IsActive.Value);
                }
                rad_IsActive = new System.Web.UI.HtmlControls.HtmlInputRadioButton();
                rad_IsActive = RG_TrainingApproval.Items[index].FindControl("rbn_Rate4") as System.Web.UI.HtmlControls.HtmlInputRadioButton;
                if (rad_IsActive.Checked)
                {
                    isChecked = true;
                    _obj_SMHR_QuestionBank.RATING_RATING = Convert.ToInt32(rad_IsActive.Value);
                }
                rad_IsActive = new System.Web.UI.HtmlControls.HtmlInputRadioButton();
                rad_IsActive = RG_TrainingApproval.Items[index].FindControl("rbn_Rate5") as System.Web.UI.HtmlControls.HtmlInputRadioButton;
                if (rad_IsActive.Checked)
                {
                    isChecked = true;
                    _obj_SMHR_QuestionBank.RATING_RATING = Convert.ToInt32(rad_IsActive.Value);
                }
                if (!isChecked)
                {
                    BLL.ShowMessage(this, "Please rate all question to proceed");
                    return;
                }

                //continue;
                if (string.Compare(rc_type.SelectedItem.Text, "Trainer", true) == 0)
                {
                    dtFeedBackTable.Rows.Add(rc_type.SelectedItem.Text, Convert.ToInt32(rc_ServiceProvider.SelectedValue), Convert.ToInt32(rc_Trainer.SelectedValue), _obj_SMHR_QuestionBank.RATING_RATING,
                                             Convert.ToInt32(Session["USER_ID"]), DateTime.Now, Convert.ToInt32(Session["USER_ID"]), DateTime.Now, Convert.ToInt32(Session["ORG_ID"]), qtnid);
                }
                else
                {
                    dtFeedBackTable.Rows.Add(rc_type.SelectedItem.Text, Convert.ToInt32(rc_ServiceProvider.SelectedValue), 0, _obj_SMHR_QuestionBank.RATING_RATING,
                                             Convert.ToInt32(Session["USER_ID"]), DateTime.Now, Convert.ToInt32(Session["USER_ID"]), DateTime.Now, Convert.ToInt32(Session["ORG_ID"]), qtnid);
                }
            }



            _obj_SMHR_QuestionBank.FEEDBACK_TABLE = dtFeedBackTable;
            _obj_SMHR_QuestionBank.OPERATION      = operation.Insert;
            if (BLL.set_Rating(_obj_SMHR_QuestionBank))
            {
                BLL.ShowMessage(this, "Information Saved Successfully");
                btn_submit.Visible               = true;
                btn_Cancel.Visible               = true;
                rc_Trainer.SelectedIndex         = -1;
                rc_ServiceProvider.SelectedIndex = -1;
                rc_type.SelectedIndex            = -1;
            }

            else
            {
                BLL.ShowMessage(this, "Information Not Saved");
                btn_submit.Visible               = true;
                btn_Cancel.Visible               = true;
                rc_Trainer.SelectedIndex         = -1;
                rc_ServiceProvider.SelectedIndex = -1;
                rc_type.SelectedIndex            = -1;
            }
            RG_TrainingApproval.Visible = false;
            btn_submit.Visible          = false;
            btn_Cancel.Visible          = false;
            rc_ServiceProvider.Items.Clear();
            rc_Trainer.Items.Clear();
        }
        catch (Exception ex)
        {
            SMHR.BLL.Error_Log(Session["USER_ID"].ToString(), ex.TargetSite.ToString(), ex.Message.Replace("'", "''"), "frm_RatingFeedbackQuestions", ex.StackTrace, DateTime.Now);
            Response.Redirect("~/Frm_ErrorPage.aspx");
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Page.User.Identity.Name == "")
     {
         Response.Redirect("../Login.aspx");
     }
     if (!IsPostBack)
     {
         ViewState["strSavePath"] = "";
         try
         {
             Tz888.SQLServerDAL.TPMerchant objtp = new Tz888.SQLServerDAL.TPMerchant();
             string  infoid = Request.QueryString["id"].ToString();
             DataSet ds     = objtp.GetOneNewsList(infoid);
             this.txtName.Value       = ds.Tables[0].Rows[0]["Title"].ToString();
             this.txtAddress.Value    = ds.Tables[0].Rows[0]["activeAdress"].ToString();
             this.stime.Value         = ds.Tables[0].Rows[0]["activeDateFrom"].ToString();
             this.txtRemarks.Value    = ds.Tables[0].Rows[0]["DesCript"].ToString();
             this.txtHostUnit.Value   = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["mainUnit"].ToString());
             this.txtHandleUnit.Value = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["secondUnit"].ToString());
             this.txtRemarks.Value    = ds.Tables[0].Rows[0]["picAbout"].ToString();
             string   strName   = ds.Tables[0].Rows[0]["Name"].ToString();
             string   strMobile = ds.Tables[0].Rows[0]["Mobile"].ToString();
             string[] strnam    = strName.Split(' ');
             string[] strmob    = strMobile.Split(' ');
             this.txtNam.Value   = strnam[0].ToString();
             this.txtPhone.Value = strmob[0].ToString();
             if (strnam.Length > 1)
             {
                 this.txtNam1.Value   = strnam[1].ToString();
                 this.txtPhone1.Value = strmob[1].ToString();
             }
             if (strnam.Length > 2)
             {
                 this.txtNam2.Value   = strnam[2].ToString();
                 this.txtPhone2.Value = strmob[2].ToString();
             }
             if (strnam.Length > 3)
             {
                 this.txtNam3.Value   = strnam[3].ToString();
                 this.txtPhone3.Value = strmob[3].ToString();
             }
             if (strnam.Length > 4)
             {
                 this.txtNam4.Value   = strnam[4].ToString();
                 this.txtPhone4.Value = strmob[4].ToString();
             }
             if (strnam.Length > 5)
             {
                 this.txtNam5.Value   = strnam[5].ToString();
                 this.txtPhone5.Value = strmob[5].ToString();
             }
             ZoneSelectControl1.ProvinceID  = ds.Tables[0].Rows[0]["ProvinceID"].ToString().Trim();
             ZoneSelectControl1.CityID      = ds.Tables[0].Rows[0]["CityID"].ToString().Trim();
             ZoneSelectControl1.CountyID    = ds.Tables[0].Rows[0]["CountyID"].ToString().Trim();
             this.txtZipCode.Value          = ds.Tables[0].Rows[0]["PostCode"].ToString();
             this.txtAddres.Value           = ds.Tables[0].Rows[0]["address"].ToString();
             this.txtEmail.Value            = ds.Tables[0].Rows[0]["Email"].ToString();
             this.txtNet.Value              = ds.Tables[0].Rows[0]["WebSite"].ToString();
             this.txtContent.Value          = Tz888.Common.Utility.PageValidate.HtmlToTxt(ds.Tables[0].Rows[0]["Content"].ToString());
             this.txtPhoneCountryCode.Value = ds.Tables[0].Rows[0]["TelCountryCode"].ToString().Trim();
             this.txtPhoneCityCode.Value    = ds.Tables[0].Rows[0]["TelStateCode"].ToString().Trim();
             this.txtPhoneNum.Value         = ds.Tables[0].Rows[0]["TelNum"].ToString().Trim();
             this.txtFaxCountryCode.Value   = ds.Tables[0].Rows[0]["FaxCountryCode"].ToString().Trim();
             this.txtFaxCityCode.Value      = ds.Tables[0].Rows[0]["FaxStateCode"].ToString().Trim();
             this.txtFaxNum.Value           = ds.Tables[0].Rows[0]["FaxNum"].ToString().Trim();
             string strNewsType = "radioType" + ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim();
             ViewState["NewsType"] = ds.Tables[0].Rows[0]["NewsTypeID"].ToString().Trim();
             string strIsPage         = "radPage" + ds.Tables[0].Rows[0]["pagestatus"].ToString().Trim();
             string strAuditingStatus = "radAuditingStatus" + ds.Tables[0].Rows[0]["AuditingStatus"].ToString().Trim();
             System.Web.UI.HtmlControls.HtmlInputRadioButton obj = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strNewsType);
             if (obj != null)
             {
                 obj.Checked = true;
             }
             System.Web.UI.HtmlControls.HtmlInputRadioButton obj1 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strIsPage);
             if (obj1 != null)
             {
                 obj1.Checked = true;
             }
             System.Web.UI.HtmlControls.HtmlInputRadioButton obj2 = (System.Web.UI.HtmlControls.HtmlInputRadioButton) this.Form.FindControl(strAuditingStatus);
             if (obj2 != null)
             {
                 obj2.Checked = true;
             }
         }
         catch (Exception ex)
         {
             Response.Write("<script>alert('请重新选择要修改的数据!');window.close();</script>");
         }
     }
     btnOK.Attributes.Add("onclick", "return chkInput();");
 }
        private void CreateMemHierarchy(short AxisOrdinal, HtmlTable hostTable , Member mem, bool HierIsAggregated , byte TreeDepth, bool autoSelect)
        {
            //do not display aggregate, display undlying calc members instead
            if(HierIsAggregated==true && mem.UniqueName==mem.Hierarchy.FilterMember.UniqueName)
            {
                MembersAggregate maggr=mem.Hierarchy.FilterMember as MembersAggregate;
                if(maggr!=null)
                {
                    for(int i=0;i<maggr.Members.Count;i++)
                    {
                        CalculatedMember cmem=maggr.Members[i] as CalculatedMember;
                        if(cmem!=null)
                            this.CreateMemHierarchy(AxisOrdinal, hostTable, cmem, HierIsAggregated, TreeDepth, false); // recursion
                    }
                }
                return;
            }

            string memIdentifier=_contr.IdentifierFromSchemaMember(mem);
            string hierIdentifier=mem.Hierarchy.Axis.Ordinal.ToString() + ":" + mem.Hierarchy.Ordinal.ToString();
            bool memIsSelected=false;
            bool memIsOpen=false;
            bool memIsPlaceholder=false;
            bool memAutoSelectChildren=(mem.Hierarchy.CalculatedMembers.GetMemberChildrenSet(mem.UniqueName)!=null);
            SchemaMember smem=mem as SchemaMember;
            if(smem!=null)
            {
                memIsOpen=smem.IsOpen;
                memIsPlaceholder=smem.IsPlaceholder;
            }

            if(HierIsAggregated)
                memIsSelected=(((MembersAggregate)mem.Hierarchy.FilterMember).Members[mem.UniqueName]!=null?true:false);
            else
                memIsSelected=(mem.Hierarchy.GetMember(mem.UniqueName)!=null);

            HtmlTableRow tr=new HtmlTableRow();
            HtmlTableCell td;
            System.Web.UI.WebControls.Button btn;
            Literal lit;

            // --- node contr col--
            td= new HtmlTableCell();
            td.Attributes.Add("class","sel_C1");
            td.NoWrap=true;
            tr.Cells.Add(td);

            // --- node name col--
            td= new HtmlTableCell();

            lit=new Literal();
            for(int i=0;i<TreeDepth;i++)
                lit.Text=lit.Text + "&nbsp;&nbsp;";
            td.Controls.Add(lit);

            if(memIsOpen)
            {
                btn=new System.Web.UI.WebControls.Button();
                btn.ToolTip="Close";
                btn.ID="sel_close:" + memIdentifier;
                btn.CssClass="sel_close";
                td.Controls.Add(btn);
            }
            else
            {
                if(mem.CanDrillDown)
                {
                    btn=new System.Web.UI.WebControls.Button();
                    btn.ToolTip="Open";
                    btn.ID="sel_open:"+memIdentifier;
                    btn.CssClass="sel_open";
                    td.Controls.Add(btn);
                }
                else
                {
                    // no image
                    lit.Text=lit.Text + "&nbsp;&nbsp;&nbsp;";
                }
            }

            if(memIsPlaceholder==false)
                if(AxisOrdinal==2 && HierIsAggregated==false)
                {
                    HtmlInputRadioButton radio=new HtmlInputRadioButton();
                    radio.Name="m:" + hierIdentifier;
                    radio.ID="m:" + memIdentifier;
                    radio.EnableViewState=false;
                    radio.Checked=(memIsSelected || autoSelect);
                    radio.Disabled=autoSelect;
                    radio.Attributes.Add("class" , "sel_chk");
                    td.Controls.Add(radio);
                }
                else
                {
                    HtmlInputCheckBox chk=new HtmlInputCheckBox();
                    chk.ID="m:" + mem.UniqueName; //note, UniqueName !
                    chk.EnableViewState=false;
                    chk.Checked=(memIsSelected || autoSelect);
                    chk.Disabled=autoSelect;
                    chk.Attributes.Add("class" , "sel_chk");
                    td.Controls.Add(chk);
                }

            lit=new Literal();
            lit.Text=mem.Name;
            td.Controls.Add(lit);

            td.Attributes.Add("class","sel_C");
            td.NoWrap=true;
            tr.Cells.Add(td);

            // --- node select col--
            td= new HtmlTableCell();

            if(AxisOrdinal!=2 && memIsOpen)
            {
                if(!memAutoSelectChildren)
                {
                    btn=new System.Web.UI.WebControls.Button();
                    btn.ToolTip="Auto-Select Children";
                    btn.ID="sel_selauto:"+memIdentifier;
                    btn.CssClass="sel_selauto";
                    td.Controls.Add(btn);

                    btn=new System.Web.UI.WebControls.Button();
                    btn.ToolTip="Select Children";
                    btn.ID="sel_selall:"+memIdentifier;
                    btn.CssClass="sel_selall";
                    td.Controls.Add(btn);
                }

                btn=new System.Web.UI.WebControls.Button();
                btn.ToolTip ="Deselect All Children";
                btn.ID="sel_deselall:"+memIdentifier;
                btn.CssClass="sel_deselall";
                td.Controls.Add(btn);
            }

            td.Attributes.Add("class","sel_C2");
            td.NoWrap=true;
            tr.Cells.Add(td);

            hostTable.Rows.Add(tr);

            if(memIsOpen==false)
                return;

            // next level members if it's schema member
            TreeDepth++;
            if(smem!=null)
            {
                for(int j=0;j<smem.Children.Count;j++)
                    CreateMemHierarchy(AxisOrdinal, hostTable, smem.Children[j] , HierIsAggregated , TreeDepth, memAutoSelectChildren);
            }
        }
		public void CleanProperties ()
		{
			HtmlInputRadioButton rb = new HtmlInputRadioButton ();
			rb.Checked = true;
			Assert.IsTrue (rb.Checked, "Checked");
			rb.Name = "name";
			Assert.AreEqual ("name", rb.Name, "Name");
			rb.Value = "value";
			Assert.AreEqual ("value", rb.Value, "Value");
			Assert.AreEqual (defaultAttributesCount + 3, rb.Attributes.Count, "1");

			rb.Checked = false;
			Assert.IsFalse (rb.Checked, "-Checked");
			rb.Name = null;
			Assert.AreEqual (String.Empty, rb.Name, "-Name");
			rb.Value = null;
			Assert.IsNull (rb.Value, "-Value");
			Assert.AreEqual (defaultAttributesCount, rb.Attributes.Count, "0");
		}
Exemple #16
0
        /// <summary>
        /// 绘制内容。
        /// </summary>
        /// <param name="writer"></param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (this.Items.Count > 0 && this.Page != null)
            {
                int len = this.Items.Count;
                TableRow tr = null;
                System.Web.UI.WebControls.Image image = null;
                TreeViewNode item = null;
                TableCell cell_0 = null, cell_1 = null, cell_2 = null;
                for (int i = 0; i < len; i++)
                {
                    item = this.Items[i];

                    tr = new TableRow();
                    cell_0 = new TableCell();
                    image = new System.Web.UI.WebControls.Image();
                    if (i < len - 1)
                    {
                        if (item.Childs.Count > 0)
                        {
                            image.ImageUrl = item.Expand ?
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Tminus.gif") :
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Tplus.gif");
                            cell_0.Attributes.Add("ep", item.Expand ? "1" : "0");
                            cell_0.Attributes.Add("onclick", string.Format("javascript:{0}_CloseOpenTree(this,'{1}','{2}');", this.GetType().Name,
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Tminus.gif"),
                                 this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Tplus.gif")
                                ));
                        }
                        else
                            image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.T.gif");
                    }
                    else
                    {
                        if (item.Childs.Count > 0)
                        {
                            image.ImageUrl = item.Expand ?
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Lminus.gif") :
                           this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Lplus.gif");
                            cell_0.Attributes.Add("ep", item.Expand ? "1" : "0");
                            cell_0.Attributes.Add("onclick", string.Format("javascript:{0}_CloseOpenTree(this,'{1}','{2}');",this.GetType().Name,
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Lminus.gif"),
                                 this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.Lplus.gif")
                                ));
                        }
                        else
                            image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.L.gif");
                    }
                    if (item.Childs.Count > 0)
                        cell_0.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
                    cell_0.Width = new Unit("17px");
                    cell_0.Controls.Add(image);
                    tr.Cells.Add(cell_0);

                    cell_1 = new TableCell();
                    image = new System.Web.UI.WebControls.Image();
                    if (item.Expand)
                        image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.openfolder.gif");
                    else
                        image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.closedfolder.gif");
                    cell_1.Width = new Unit("16px");
                    cell_1.Controls.Add(image);
                    tr.Cells.Add(cell_1);

                    if (this.ShowCheckBox)
                    {
                        TableCell cellBox = new TableCell();
                        cellBox.Width = new Unit("17px");
                        if (this.CheckType == CheckBoxType.CheckBox)
                        {
                            HtmlInputCheckBox checkBox = new HtmlInputCheckBox();
                            checkBox.ID = string.Format("{0}_chkb_{1}", this.ClientID, item.Value);
                            checkBox.Name = string.Format("{0}_chkb", this.ClientID);
                            checkBox.Value = item.Value;
                            if (this.EnabledCheckValueChecked)
                                checkBox.Checked = this.checkedValueCollection.Contains(item.Value);
                            else
                                checkBox.Checked = item.Checked;
                            checkBox.Attributes.Add("onclick", string.Format("javascript:{0}_CheckAll(this);", this.GetType().Name));
                            cellBox.Controls.Add(checkBox);
                        }
                        else
                        {
                            HtmlInputRadioButton radio = new HtmlInputRadioButton();
                            radio.ID = string.Format("{0}_rd_{1}", this.ClientID, item.Value);
                            radio.Name = string.Format("{0}_rd", this.ClientID);
                            radio.Value = item.Value;
                            if (this.EnabledCheckValueChecked)
                                radio.Checked = this.checkedValueCollection.Contains(item.Value);
                            else
                                radio.Checked = item.Checked;
                            cellBox.Controls.Add(radio);
                        }
                        tr.Cells.Add(cellBox);
                    }

                    cell_2 = new TableCell();
                    cell_2.Width = new Unit("100%");
                    cell_2.HorizontalAlign = HorizontalAlign.Left;
                    if (!string.IsNullOrEmpty(item.HrefURL) || !string.IsNullOrEmpty(item.ClickAction) || this.EnabledNodeClickEvent)
                    {
                        HtmlAnchor link = new HtmlAnchor();
                        link.Attributes.Add("class", "TreeViewA");
                        if (this.CurrentFolderValue == item.Value)
                        {
                            HtmlGenericControl span = new HtmlGenericControl("span");
                            span.Attributes.Add("class", "TreeViewCurrentNode");
                            span.InnerText = item.Text;
                            link.Controls.Add(span);
                        }
                        else
                            link.Controls.Add(new LiteralControl(item.Text));
                        link.HRef = string.IsNullOrEmpty(item.HrefURL) ? "#" : item.HrefURL;

                        if (this.EnabledNodeClickEvent && this.Page != null)
                            link.Attributes.Add("onclick", this.Page.ClientScript.GetPostBackEventReference(this, HttpUtility.HtmlEncode(item.Value)));
                        else if (!string.IsNullOrEmpty(item.ClickAction))
                            link.Attributes.Add("onclick", item.ClickAction);
                        cell_2.Controls.Add(link);
                        cell_2.Style.Add(HtmlTextWriterStyle.Cursor, "pointer");
                    }
                    else
                        cell_2.Text = item.Text;
                    tr.Cells.Add(cell_2);

                    tr.RenderControl(writer);

                    if (item.Childs.Count > 0)
                    {
                        tr = new TableRow();
                        if (!item.Expand)
                            tr.Style.Add(HtmlTextWriterStyle.Display, "none");
                        cell_0 = new TableCell();
                        cell_0.Width = new Unit("17px");
                        if (i < len - 1)
                        {
                            cell_0.Style.Add(HtmlTextWriterStyle.BackgroundImage, string.Format("url({0})",
                                this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.I.gif")));
                        }
                        else if (i != len - 1)
                        {
                            image = new System.Web.UI.WebControls.Image();
                            image.ImageUrl = this.Page.ClientScript.GetWebResourceUrl(typeof(TreeView), "iPower.Web.TreeView.L.gif");
                            cell_0.Controls.Add(image);
                        }
                        tr.Cells.Add(cell_0);
                        cell_1 = new TableCell();
                        cell_1.Width = new Unit("100%");
                        cell_1.ColumnSpan = this.ShowCheckBox ? 3 : 2;
                        this.CreateTreeView(item, cell_1);
                        cell_1.VerticalAlign = VerticalAlign.Top;
                        tr.Cells.Add(cell_1);
                        tr.RenderControl(writer);
                    }
                }
            }
        }
Exemple #17
0
 protected virtual void SetIndexValue(HtmlInputRadioButton radioSelector)
 {
     GridViewRow row = radioSelector.NamingContainer as GridViewRow;
     if (row != null)
     {
         radioSelector.Value = row.RowIndex.ToString();
     }
 }
Exemple #18
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            SetPageTitle("新建/编辑企业信息");
            // 06/04/2006   Visibility is already controlled by the ASPX page, but it is probably a good idea to skip the load. 
            // 03/10/2010   Apply full ACL security rules. 
            this.Visible = (Taoqi.Security.AdminUserAccess(m_sMODULE, "list") >= 0);
            if (!this.Visible)
            {
                // 03/17/2010   We need to rebind the parent in order to get the error message to display. 
                Parent.DataBind();
                return;
            }

            try
            {
                gID = Sql.ToGuid(Request["ID"]);
                if (!IsPostBack)
                {
                    if (!Sql.IsEmptyGuid(gID))
                    {
                        DbProviderFactory dbf = DbProviderFactories.GetFactory();
                        using (IDbConnection con = dbf.CreateConnection())
                        {
                            string sSQL;
                            // 09/08/2010   We need a separate view for the list as the default view filters by MODULE_ENABLED 
                            // and we don't want to filter by that flag in the ListView, DetailView or EditView. 
                            sSQL = "select * " + ControlChars.CrLf
                                 + " from vwTQClient" + ControlChars.CrLf
                                 + " where 1 = 1 " + ControlChars.CrLf;
                            using (IDbCommand cmd = con.CreateCommand())
                            {
                                cmd.CommandText = sSQL;
                                Sql.AppendParameter(cmd, gID, "ID", false);
                                con.Open();
                            }
                        }
                    }
                    else
                    {
                        this.AppendEditViewFields(m_sMODULE + "." + LayoutEditView, tblMain, null);
                        ctlDynamicButtons.AppendButtons(m_sMODULE + "." + LayoutEditView, Guid.Empty, null);
                        ctlFooterButtons.AppendButtons(m_sMODULE + "." + LayoutEditView, Guid.Empty, null);

                        var C_CustomerManager = new DynamicControl(this, "C_CustomerManager");

                        if (C_CustomerManager != null)
                        {
                            C_CustomerManager.Text = Security.FULL_NAME;
                        }
                    }
                }
                else
                {
                    ctlModuleHeader.Title = Sql.ToString(ViewState["ctlModuleHeader.Title"]);
                    SetPageTitle(L10n.Term(".moduleList." + m_sMODULE) + " - " + ctlModuleHeader.Title);
                }
            }
            catch (Exception ex)
            {
                SplendidError.SystemError(new StackTrace(true).GetFrame(0), ex);
                //ctlDynamicButtons.ErrorText = ex.Message;
            }

            if (Request.QueryString["isDlg"] != null)
            {

                //2014.12.14           
                Button btnCancel = this.ctlDynamicButtons.FindButton("Cancel") as Button;

                if (btnCancel != null)
                {
                    btnCancel.Visible = false;
                }

                Button btnCancel_footer = this.ctlFooterButtons.FindButton("Cancel") as Button;

                if (btnCancel_footer != null)
                {
                    btnCancel_footer.Visible = false;
                }
            }

            gUserID = Security.USER_ID;
            if (!Guid.TryParse(Request.QueryString["id"], out gClientID))
                Response.Redirect("~/Client");

            txtClientName = FindControl("txtClientName") as HtmlInputText;
            txtClientShortName = FindControl("txtClientShortName") as HtmlInputText;
            hiddenUserID = FindControl("hiddenUserID") as HiddenField;
            txtUserName = FindControl("txtUserName") as TextBox;

            cbxSeller = FindControl("cbxSeller") as HtmlInputCheckBox;
            cbxBuyer = FindControl("cbxBuyer") as HtmlInputCheckBox;

            //C_Status_WSH = FindControl("C_Status_WSH") as HtmlInputRadioButton;
            C_Status_TG = FindControl("C_Status_TG") as HtmlInputRadioButton;
            C_Status_WTG = FindControl("C_Status_WTG") as HtmlInputRadioButton;
            C_Status_TGBQJRRM = FindControl("C_Status_TGBQJRRM") as HtmlInputRadioButton;

            if(!IsPostBack)
                AccountInformation();

            if (IsPostBack)
            {
                if (Request.Form["Save"] == "Save")
                {
                    Guid.TryParse(hiddenUserID.Value, out NewBossID);
                    if (NewBossID == Guid.Empty)
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsg",
                            "layer.alert('请为该公司指定管理员!', {area:['385px','178px'],offset:['195px','500px']});", true);
                        return;
                    }

                    if (C_Status_TG.Checked)
                        C_Status = 2;
                    else if (C_Status_WTG.Checked)
                        C_Status = 3;
                    else
                    {
                        ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "errorMsg",
                            "layer.alert('审核意见必选!', {area:['385px','178px'],offset:['195px','500px']});", true);
                        return;
                    }

                    C_Category = GetUserType();
                    C_ClientShortName = txtClientShortName.Value;

                    SqlProcs.spTQClient_Update_ForAdmin(
                        ref gClientID
                        , C_Category
                        , C_ClientShortName
                        , NewBossID
                        , C_BossRole
                        , Security.USER_ID
                        , C_Status
                        );
                                        
                    if (C_Status == 2)  // 审核成功
                        Msg.ClientAudit(NewBossID, gClientID);
                    else
                        Msg.ClientAudit(NewBossID, gClientID, false);

                    Response.Redirect("default.aspx");
                }
                else if (Request.Form["Cancel"] == "Cancel")
                {
                    Response.Redirect("default.aspx");
                }
            }

            if (!IsPostBack)
                showInformation();
        }
Exemple #19
0
		public void InstantiateIn(Control objContainer)
		{
			HtmlInputRadioButton rad = new HtmlInputRadioButton();
			rad.DataBinding += new EventHandler(rad_DataBinding);
			objContainer.Controls.Add(rad);
		}
Exemple #20
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ddl"></param>
        /// <param name="menus"></param>
        /// <param name="parentCode"></param>
        /// <param name="prefix"></param>
        private void buildCatalogTree(Table tbl, List<cmsNewsCatalog> catalogs, List<cmsNewsCatalog> childs, string prefix)
        {
            string pf = "";

            for (int i = 0; i < childs.Count; i++)
            {
                cmsNewsCatalog item = childs[i];
                List<cmsNewsCatalog> children = catalogs.FindAll(m => m.ParentCode == item.NodeCode);
                if (item.NodeType<8 && (IsAdmin || PurviewExists(item.NodeCode, 0)))
                {
                    TableRow tr = new TableRow();
                    tr.CssClass = "Row";

                    // 单选框
                    TableCell td = new TableCell();

                    td.Width = Unit.Pixel(20);
                    HtmlInputRadioButton rb = new HtmlInputRadioButton();
                    rb.ID = "C" + item.NodeCode;
                    rb.Attributes.Add("class", "C");
                    rb.Value = item.NodeCode;
                    rb.Attributes.Add("onclick", "selectCatalog(this);");
                    if (children.Count > 0) rb.Attributes.Add("disabled", "disabled");
                    td.Controls.Add(rb);
                    tr.Cells.Add(td);
                    // 栏目名称
                    td = new TableCell();
                    td.Style.Add("text-align", "left");
                    //td.Style.Add("padding-left", "10px");
                    if (i < childs.Count - 1)
                    {
                        td.Text = prefix + "├" + item.NodeName;
                        pf = prefix + "│";
                    }
                    else
                    {
                        td.Text = prefix + "└" + item.NodeName;
                        pf = prefix + " "; // 全角空格[ ]制表符[│][├][└]
                    }
                    tr.Cells.Add(td);

                    tbl.Rows.Add(tr);

                    if (children.Count > 0)
                    {
                        buildCatalogTree(tbl, catalogs, children, pf);
                    }
                    else
                    {
                        if (item.NodeType == 0) tbl.Rows.Remove(tr);
                    }
                }
            }
        }
        private void CreateTable()
        {
            if(this.DataSource==null)
                return;

            TableRow row;
            TableCell cell;
            HtmlInputRadioButton radio;
            HtmlInputCheckBox chkbox;

            int currentPage=this.CurrentPage;

            if(EnablePages==false)
                PageSize=DataSource.Rows.Count;

            int startIndex=this.CurrentPage*PageSize-PageSize;
            int endIndex=this.CurrentPage*PageSize-1;

            if(endIndex>=DataSource.DefaultView.Count)
                endIndex=DataSource.DefaultView.Count-1;

            if(startIndex>endIndex)
                if(endIndex+1>PageSize)
                {
                    startIndex=0;
                    endIndex=PageSize-1;
                }
                else
                {
                    startIndex=0;
                    //endIndex is same
                }

            for(int rowIndex=startIndex ; rowIndex<=endIndex ; rowIndex++)
            {
                row=new TableRow();
                //first column

                cell=new TableCell();
                cell.CssClass="tbl1_chk";
                cell.Visible=false;

                if(EnableCheckBoxes==true)
                {
                    cell.Visible=true;
                    //string primaryKeyString=string.Join(_primaryKeySeparator, this.PrimaryKeyColumnArray);
                    string primaryKeyValue="";
                    for(int i=0;i<this.PrimaryKeyColumnArray.Length;i++)
                    {
                        if(i!=0)
                            primaryKeyValue+=_primaryKeySeparator;
                        primaryKeyValue+=DataSource.DefaultView[rowIndex][this.PrimaryKeyColumnArray[i].ToString()].ToString();
                    }

                    if(EnableMultipleSelection==false)
                    {

                        radio=new HtmlInputRadioButton();
                        radio.Name="chk_";
                        radio.Value=primaryKeyValue;
                        radio.EnableViewState=false;
                        cell.Controls.Add(radio);
                    }
                    else
                    {
                        chkbox=new HtmlInputCheckBox();
                        chkbox.Name=this.UniqueID;
                        chkbox.Value=primaryKeyValue;
                        chkbox.ID="chk_" + rowIndex.ToString();
                        chkbox.EnableViewState=false;
                        cell.Controls.Add(chkbox);
                    }

                }

                row.Cells.Add(cell);

                for(int i=0;i<this.ColumnNameArray.Length;i++)
                {
                    string columnName=this.ColumnNameArray[i];
                    int columnWidth=this.ColumnWidthArray[i];

                    if (columnWidth<=0)
                    {
                        continue;	//we're not displaying curDSColumn
                    }

                    cell=new TableCell();
                    cell.CssClass="tbl1_item";
                    CreateTableCell(cell , columnName , rowIndex , DataSource.DefaultView[rowIndex].Row);
                    row.Cells.Add(cell);
                }
                GridTable.Rows.Add(row);
            }
        }
Exemple #22
0
        /// <summary>
        /// Creates a table and inserts the Poll Questions and the
        /// submt button
        /// </summary>
        /// <returns></returns>
        protected bool MkControls()
        {
            HtmlTable				m_Table;
            HtmlTableRow			m_Row;
            HtmlTableCell			m_Cell;
            HtmlInputRadioButton    m_Rdo;
            Button					m_Btn;

            //Set the table properties
            m_Table				=	new HtmlTable();
            m_Table.Border		=	1;
            m_Table.CellPadding	=	1;
            m_Table.CellSpacing	=	0;
            m_Table.BorderColor =	"#000000";
            m_Table.BgColor		=	"#FFFFEE";
            m_Table.Width		=	"160px";

            // Get Poll Question
            pQ = new PollQuestion(m_whichPoll,m_connString);

            // If there isn't a valid Poll then exit
            if (pQ.Found!=true) return false;

            // Get the Question Answers
            alAnswers = pQ.alAnswers;

            // First Table Row for Question
            m_Row  = new HtmlTableRow();
            m_Cell = new HtmlTableCell();
            m_Cell.ColSpan   = 2;
            m_Cell.Align     = "center";
            m_Cell.InnerHtml = "<font size='1' face='arial'><b>"+pQ.Question+"</b></font>";
            m_Row.Cells.Add(m_Cell);
            m_Table.Rows.Add(m_Row);

            // Poll Answers
            RdoValues = new ArrayList();		// New Array for Poll Answers
            for (int i=0;i<pQ.NumberAnswers;i++)
            {
                pA				= (PollAnswer)alAnswers[i];
                m_Row           = new HtmlTableRow();

                // This cell shows the checkbox
                m_Rdo			= new HtmlInputRadioButton();
                m_Rdo.ID		= String.Format("R{0}",i);
                m_Rdo.Name		= "G1"; // Group Name
                RdoValues.Add(m_Rdo);
                m_Cell	        = new HtmlTableCell();
                m_Cell.Align	= "center";
                m_Cell.Controls.Add(m_Rdo);
                m_Row.Cells.Add(m_Cell);

                // This cell shows the Answer
                m_Cell = new HtmlTableCell();
                m_Cell.InnerHtml = "&nbsp<font size='1' face='arial'>"+pA.Answer+"</font>";
                m_Row.Cells.Add(m_Cell);

                // Add the Row to the table
                m_Table.Rows.Add(m_Row);
            }

            // Show Previous Number of Responses
            m_Row			= new HtmlTableRow();
            m_Cell			= new HtmlTableCell();
            m_Cell.ColSpan	= 2;
            m_Cell.Align    = "center";
            m_Label  	    = new Label();
            m_Label.Text   += string.Format("<font size='1' face='arial'>{0} Responses</font>",pQ.TotalAnswers);
            m_Cell.Controls.Add(m_Label);
            m_Row.Cells.Add(m_Cell);
            m_Table.Rows.Add(m_Row);

            // Add the Submit Button
            m_Row			= new HtmlTableRow();
            m_Cell			= new HtmlTableCell();
            m_Cell.ColSpan	= 3;
            m_Cell.Align    = "center";
            m_Btn		    = new Button();
            m_Btn.Click	   += new System.EventHandler (this.Btn_Click);
            m_Btn.Text      = "Submit";
            m_Btn.ForeColor = Color.White;
            m_Btn.BackColor = Color.DarkBlue;
            m_Btn.Font.Bold = true;
            m_Btn.Font.Name = "Arial";
            m_Btn.Font.Size = 8;

            m_Cell.Controls.Add(m_Btn);
            m_Row.Cells.Add(m_Cell);
            m_Table.Rows.Add(m_Row);
            Ph.Controls.Add(m_Table);  // Add the Poll Table
            return true;
        }