protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblitemid = (Label)e.Row.FindControl("lblitemid"); //部件品号id RadioButtonList rblComModel = (RadioButtonList)e.Row.FindControl("rblComModel"); //部件流程列表 //由品号查找流程 string sql = "select id,name from ta_procedure where modelid='" + lblitemid.Text + "'"; ds = Methods.getInforBySql(sql); rblComModel.DataValueField = "id"; rblComModel.DataTextField = "name"; rblComModel.DataSource = ds; rblComModel.DataBind(); //将原有的值设置有效状态 this.setChecked(rblComModel, lblitemid.Text); rblComModel.Enabled = ViewState["rblEnable"].ToString().Equals("true"); //将原有的值保存下来用于后面判断流程是否发生改变 Label rblComModelOld = (Label)e.Row.FindControl("rblComModelOld"); //临时保存之前的部件流程选项 if (rblComModel.SelectedIndex > -1) { rblComModelOld.Text = rblComModel.Items[rblComModel.SelectedIndex].Value; } } }
/// <summary> /// 将list绑定到控件上 /// </summary> /// <param name="defaultValue">默认选中值</param> public static void BindLst <T>(System.Web.UI.WebControls.WebControl c, List <T> lst, string textField, string valueField, string value, bool flag) { if (null != lst && lst.Count > 0) { if (c is DropDownList) { DropDownList ddl = ((DropDownList)c); ddl.DataSource = lst; ddl.DataTextField = textField; ddl.DataValueField = valueField; ddl.DataBind(); if (!string.IsNullOrEmpty(value)) { ddl.SelectedValue = value; } if (flag) { ddl.Items.Insert(0, new System.Web.UI.WebControls.ListItem("--请选择--", "-1")); } } else if (c is RadioButtonList) { RadioButtonList rb = ((RadioButtonList)c); rb.DataSource = lst; rb.DataTextField = textField; rb.DataValueField = valueField; rb.DataBind(); if (!string.IsNullOrEmpty(value)) { rb.SelectedValue = value; } } } }
/// <summary> /// 绑定DataTable:RadioButtonList单选框 /// </summary> /// <param name="dt">DataTable</param> /// <param name="rbllist">控件名称</param> /// <param name="_Name">绑定字段名称</param> /// <param name="_ID">绑定字段主键</param> public static void BindRadioButtonList(DataTable dt, RadioButtonList rbllist, string _Name, string _ID) { rbllist.DataSource = dt; rbllist.DataTextField = _Name; rbllist.DataValueField = _ID; rbllist.DataBind(); }
// public static void bindListBoxHn(string ProcName, ListBox ddl, string parm1, string parm2, string parm3) // { // DataSet ds = new DataSet(); // if (parm1.Length > 0 && parm1 != "") // { // List<SqlParameter> parameters = new List<SqlParameter>(); // parameters.Add(new SqlParameter("@Parm1", parm1)); // if (parm2.Length > 0 && parm2 != "") // parameters.Add(new SqlParameter("@Parm2", parm2)); // if (parm3.Length > 0 && parm3 != "") // parameters.Add(new SqlParameter("@Parm3", parm3)); // ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName, parameters.ToArray()); // } // else // { // ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName); // } // ddl.Items.Clear(); // if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) // { // ddl.DataSource = ds; // ddl.DataTextField = "ValueText"; // ddl.DataValueField = "ValueId"; // ddl.DataBind(); // } // ddl.Items.Insert(0, new ListItem("-- समस्त --", "0", true)); // } public static void bindRadioBoxHn(string ProcName, RadioButtonList ddl, string parm1, string parm2, string parm3) { DataSet ds = new DataSet(); if (parm1.Length > 0 && parm1 != "") { List <SqlParameter> parameters = new List <SqlParameter>(); parameters.Add(new SqlParameter("@Parm1", parm1)); if (parm2.Length > 0 && parm2 != "") { parameters.Add(new SqlParameter("@Parm2", parm2)); } if (parm3.Length > 0 && parm3 != "") { parameters.Add(new SqlParameter("@Parm3", parm3)); } ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName, parameters.ToArray()); } else { ds = SqlHelper.ExecuteDataset(CommonConfig.Conn(), CommandType.StoredProcedure, ProcName); } ddl.Items.Clear(); if (ds != null && ds.Tables[0] != null && ds.Tables[0].Rows.Count > 0) { ddl.DataSource = ds; ddl.DataTextField = "ValueText"; ddl.DataValueField = "ValueId"; ddl.DataBind(); } }
protected void rptrProductDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string PBrandID = (e.Item.FindControl("hfBrandID") as HiddenField).Value; string PCategoryID = (e.Item.FindControl("hfCatID") as HiddenField).Value; string PGenericID = (e.Item.FindControl("hfGenericID") as HiddenField).Value; RadioButtonList rblSize = e.Item.FindControl("rblSize") as RadioButtonList; String CS = ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString1"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { using (SqlCommand cmd = new SqlCommand("select * from tblProducts where PBrandID=" + PBrandID + " and PCategoryID=" + PCategoryID + " and PGenericID=" + PGenericID + "", con)) { cmd.CommandType = CommandType.Text; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dtBrands = new DataTable(); sda.Fill(dtBrands); rblSize.DataSource = dtBrands; rblSize.DataTextField = "PSize"; rblSize.DataValueField = "PID"; rblSize.DataBind(); } } } } }
//populate the options for each question protected void questionsrpt_ItemDataBound(object sender, RepeaterItemEventArgs e) { int qid = 0; if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { //get the questionid HiddenField hfl = (HiddenField)e.Item.FindControl("hfID"); qid = Convert.ToInt32(hfl.Value); //get the options for this questionid RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("rbloptions"); DataTable qTable = new DataTable(); SqlCommand getoptions = new SqlCommand("select id, questionoption from " + quizquestionoptionstable + " where questionid=@questionid"); getoptions.Parameters.AddWithValue("questionid", qid); db getoptionslist = new db(); qTable = getoptionslist.returnDataTable(getoptions); if (qTable.Rows.Count > 0) { rbl.DataSource = qTable; rbl.DataTextField = "questionoption"; rbl.DataValueField = "id"; rbl.DataBind(); } } }
protected void RptrProductDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { Int64 ProductId = Convert.ToInt64(Request.QueryString["ProductId"]); string BrandID = (e.Item.FindControl("hfBrandID") as HiddenField).Value; string CatID = (e.Item.FindControl("hfCatID") as HiddenField).Value; string WarrantyID = (e.Item.FindControl("hfWarrantyID") as HiddenField).Value; RadioButtonList rblSize = e.Item.FindControl("rblSize") as RadioButtonList; String CS = ConfigurationManager.ConnectionStrings["MyDatabaseConnectionString1"].ConnectionString; using (SqlConnection con = new SqlConnection(CS)) { using (SqlCommand cmd = new SqlCommand("select * from ProductColorTable where ProductId=" + ProductId + "", con)) { cmd.CommandType = CommandType.Text; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dtBrands = new DataTable(); sda.Fill(dtBrands); rblSize.DataSource = dtBrands; rblSize.DataTextField = "ProductColor"; rblSize.DataValueField = "ProductColorId"; rblSize.DataBind(); } } } } }
protected void GridView_UnAssignedCriteria_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { int iQuestionID = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "ID").ToString()); int Grading_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grading_Type").ToString()); RadioButtonList rdo = (RadioButtonList)e.Row.FindControl("rdoOptions"); TextBox txtAnswer = (TextBox)e.Row.FindControl("txtAnswer"); TextBox txtRemarks = (TextBox)e.Row.FindControl("txtRemarks"); if (rdo != null) { DataTable dt = BLL_Crew_Interview.Get_GradingOptions(Grading_Type); rdo.DataSource = dt; rdo.DataBind(); } } } catch { } }
///--------------------------------------------------------------------------------- ///--------------------------------------------------------------------------------- protected void dvControl_DataBound(object sender, EventArgs e) { DetailsView dv = (DetailsView)sender; Control datafield = dv.Rows[0].Controls[1]; HiddenField hf1 = (HiddenField)datafield.FindControl("hfStatusId"); HiddenField hf2 = (HiddenField)datafield.FindControl("hfContactBId"); RadioButtonList rbl = (RadioButtonList)datafield.FindControl("rblStatus"); rbl.DataSource = BllProxyLookup.GetIncidentStatuses(); rbl.DataBind(); statusId = Convert.ToInt32(hf1.Value); if (statusId != 0) { rbl.Items.FindByValue(statusId.ToString()).Selected = true; } dv.Rows[4].Visible = !this.isStatusChangeable; // Status Text dv.Rows[5].Visible = this.isStatusChangeable; // Status Radio buttons }
public bool LlenarRadioBL_Web(RadioButtonList Generico) { if (!Validar()) { return(false); } clsConexionBD objConexionBD = new clsConexionBD(); objConexionBD.SQL = strSQL; objConexionBD.NombreTabla = strNombreTabla; if (!objConexionBD.LlenarDataSet(false)) { strError = objConexionBD.Error; objConexionBD.CerrarConexion(); objConexionBD = null; return(false); } Generico.DataSource = objConexionBD.MiDataSet.Tables[strNombreTabla]; Generico.DataTextField = strColumnaTexto; Generico.DataValueField = strColumnaValor; Generico.DataBind(); objConexionBD.CerrarConexion(); objConexionBD = null; return(true); }
public void SetRadioButtonList(RadioButtonList rbl, string procedure, string column, string value, SqlParameter parametro) { rbl.DataSource = GetDataSet(procedure, parametro); rbl.DataTextField = column; rbl.DataValueField = value; rbl.DataBind(); }
public void fillrbl(string sql, RadioButtonList rbl, string txt, string value) { rbl.DataTextField = txt; rbl.DataValueField = value; rbl.DataSource = exedataset(sql); rbl.DataBind(); }
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { int id = int.Parse(((Label)e.Item.FindControl("lb_ID")).Text); QNA_QuestionBLL q = new QNA_QuestionBLL(id); RadioButtonList rbl_Result = (RadioButtonList)e.Item.FindControl("rbl_Result"); CheckBoxList cbl_Result = (CheckBoxList)e.Item.FindControl("cbl_Result"); TextBox tbx_Result = (TextBox)e.Item.FindControl("tbx_Result"); if (q.Model != null) { switch (q.Model.OptionMode) { case 1: //单选 rbl_Result.DataSource = q.Items; rbl_Result.DataBind(); rbl_Result.Visible = true; break; case 2: //多选 cbl_Result.DataSource = q.Items; cbl_Result.DataBind(); cbl_Result.Visible = true; break; case 3: //输入文本 tbx_Result.Visible = true; break; } } } }
public void LlenarRadioButtonList <T>(RadioButtonList radiobuttonlist, List <T> lista, string titulo, string valor) { radiobuttonlist.DataSource = lista; radiobuttonlist.DataTextField = titulo; radiobuttonlist.DataValueField = valor; radiobuttonlist.DataBind(); }
public void LlenarRadioButtonList(RadioButtonList radiobuttonlist, DataTable datatable, string titulo, string valor) { radiobuttonlist.DataSource = datatable; radiobuttonlist.DataTextField = titulo; radiobuttonlist.DataValueField = valor; radiobuttonlist.DataBind(); }
protected void rpList_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView drv = (DataRowView)e.Item.DataItem; int teammodelrole = int.Parse(drv["TeamModelRoleID"].ToString()); RadioButtonList rbl = (RadioButtonList)e.Item.FindControl("rblTeam"); HtmlInputCheckBox hicb = (HtmlInputCheckBox)e.Item.FindControl("cblRole"); hicb.Value = teammodelrole.ToString(); rbl.DataSource = bllTeam.GetListForRole(new E_Team() { EnterpriseID = EnterpriceID, TeamModelRoleID = teammodelrole }); rbl.DataTextField = "TeamName"; rbl.DataValueField = "TeamID"; rbl.DataBind(); if (dt != null && dt.Select("TeamModelRoleID=" + teammodelrole).Count() > 0) { hicb.Checked = true; rbl.SelectedValue = dt.Select("TeamModelRoleID=" + teammodelrole)[0]["TeamID"].ToString(); } else { rbl.Enabled = false; } } }
public clsWDataSet.clsReturnObject FillRadioList(WebControl ctlControl, string strSPName, string[] strKeyName, object[] strKeyValue, string DisPlayMember, string ValueMember) { clsWDataSet objWDataSet = new clsWDataSet(); try { DataTable dtltemp; clsWDataSet.clsReturnObject objReturn; objReturn = objWDataSet.GetAllRecordsByNID(strSPName, strKeyName, strKeyValue); if (objReturn.intCode != 0) { if (ctlControl.GetType() == typeof(RadioButtonList)) { RadioButtonList cbo = (RadioButtonList)ctlControl; dtltemp = objReturn.dstResult.Tables[0]; cbo.DataTextField = DisPlayMember; cbo.DataValueField = ValueMember; cbo.DataSource = dtltemp; cbo.DataBind(); } } return(objReturn); } catch (Exception ex) { throw new Exception(ex.Message); } }
public void RadioButtonList(RadioButtonList theRadioButton, DataTable theDT, string theTextField, string theValueField) { theRadioButton.DataSource = theDT; theRadioButton.DataTextField = theTextField; theRadioButton.DataValueField = theValueField; theRadioButton.DataBind(); }
protected void rptrProductDetails_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { string BrandID = (e.Item.FindControl("hfBrandID") as HiddenField).Value; string CatID = (e.Item.FindControl("hfCatID") as HiddenField).Value; string SubCatID = (e.Item.FindControl("hfSubCatID") as HiddenField).Value; string GenderID = (e.Item.FindControl("hfBrandID") as HiddenField).Value; RadioButtonList rblSize = e.Item.FindControl("rblSize") as RadioButtonList; using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("select * from tblSizes where BrandID=" + BrandID + "and CategoryID=" + CatID + " and SubCategoryID=" + SubCatID + " and GenderID=" + GenderID + "", con); cmd.CommandType = CommandType.Text; using (SqlDataAdapter sda = new SqlDataAdapter(cmd)) { DataTable dtBrands = new DataTable(); sda.Fill(dtBrands); rblSize.DataSource = dtBrands; rblSize.DataTextField = "sizename"; rblSize.DataValueField = "sizeid"; rblSize.DataBind(); } } } }
protected void grdGrading_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { int ID = UDFLib.ConvertToInteger(grdGrading.DataKeys[e.Row.RowIndex].Value.ToString()); Label lblGrdUsed = (Label)e.Row.FindControl("lblGradeIsUsed"); ImageButton LinkButton1del = (ImageButton)e.Row.FindControl("LinkButton1del"); if (lblGrdUsed.Text == "TRUE") { LinkButton1del.Visible = false; } else { LinkButton1del.Visible = true; } RadioButtonList rdoOptions = (RadioButtonList)e.Row.FindControl("rdoOptions"); DataTable dtGradOption = GetGradingOptions(ID); rdoOptions.DataSource = dtGradOption; rdoOptions.DataTextField = Convert.ToString(dtGradOption.Columns["optiontext"]); rdoOptions.DataValueField = Convert.ToString(dtGradOption.Columns["optionvalue"]); rdoOptions.DataBind(); } } catch { } }
protected void grdQuestion_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int ID = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grading_Type").ToString()); int Grade_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grade_Type").ToString()); RadioButtonList rdo = (RadioButtonList)e.Row.FindControl("rdoOptions"); Label lblQUESTION_IS_USED = (Label)e.Row.FindControl("lblQUESTION_IS_USED"); ImageButton btnDele = (ImageButton)e.Row.FindControl("LinkButton1del"); //btnDele.Visible = Convert.ToBoolean(lblQUESTION_IS_USED.Text); if (rdo != null) { DataTable dtrdo = GetGradingOptions(ID); rdo.DataSource = dtrdo; rdo.DataBind(); } if ((e.Row.RowState & DataControlRowState.Edit) > 0) { //DropDownList ddlGridView_GradingType = (DropDownList)e.Row.FindControl("ddlGradingType"); //DataTable dt = BLL_PURC_Common.Get_GradingList(); //ddlGridView_GradingType.DataSource = dt; //ddlGridView_GradingType.DataBind(); } } }
protected void gvDoctores_RowEditing(object sender, GridViewEditEventArgs e) { try { gvDoctores.EditIndex = e.NewEditIndex; // cambiar a modo editar LlenargvDoctores(); //recargar el gv DropDownList ddlSexo = (DropDownList)gvDoctores.Rows[e.NewEditIndex].FindControl("ddlSexoEIT"); ddlSexo.DataSource = new BusSexo().Obtener(); ddlSexo.DataTextField = "Nombre_Sexo"; ddlSexo.DataValueField = "Id_Sexo"; ddlSexo.DataBind(); ddlSexo.SelectedValue = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Sexo_Doctor"].ToString(); RadioButtonList rbinter = (RadioButtonList)gvDoctores.Rows[e.NewEditIndex].FindControl("rbInterEIT"); rbinter.DataSource = new BusIntervencion().Obtener(); rbinter.DataTextField = "Nombre_Intervencion"; rbinter.DataValueField = "Id_Intervencion"; rbinter.DataBind(); rbinter.DataSource = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Intervencion_Doctor"].ToString(); CheckBoxList chkTurno = (CheckBoxList)gvDoctores.Rows[e.NewEditIndex].FindControl("chkTurnoEIT"); chkTurno.DataSource = new BusTurno().Obtener(); chkTurno.DataTextField = "Nombre_Turno"; chkTurno.DataValueField = "Id_Turno"; chkTurno.DataBind(); chkTurno.DataSource = gvDoctores.DataKeys[e.NewEditIndex].Values["Id_Turno_Doctor"].ToString(); } catch (Exception ex) { MostrarMensaje(ex.Message); } }
protected void m_dgvGrid_ItemDataBound(object source, GridItemEventArgs e) { var item = e.Item as GridEditableItem; // Already in edit mode but not a new insert if (item != null && item.IsInEditMode && !item.OwnerTableView.IsItemInserted) // Edit or Insert { m_device = Device((e.Item as GridEditableItem).GetDataKeyValue("ID"), Entity(m_cboEntities.SelectedValue)); RadioButtonList rList = e.Item.FindControl("m_rblTypes") as RadioButtonList; rList.SelectedIndex = -1; foreach (ListItem rItem in rList.Items) { rItem.Selected = false; if (rItem.Value.Equals(m_device.Type.ToString(), StringComparison.OrdinalIgnoreCase)) { rItem.Selected = true; rList.DataBind(); break; } } } }
protected void rptPELTypes_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item | e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dRow = (DataRowView)e.Item.DataItem; DataView dvPELS = new DataView(_dtCampaignPELs, "TemplateTypeDescription = '" + dRow["TemplateTypeDescription"].ToString() + "'", "", DataViewRowState.CurrentRows); RadioButtonList rblList = (RadioButtonList)e.Item.FindControl("rblPELs"); rblList.BorderStyle = BorderStyle.Solid; rblList.BorderWidth = Unit.Pixel(1); rblList.DataTextField = "TemplateDescription"; rblList.DataValueField = "PELTemplateID"; rblList.DataSource = dvPELS; rblList.DataBind(); rblList.Items.Add(new ListItem("No Default", "")); DataView dvDefault = new DataView(_dtCampaignPELs, "TemplateTypeDescription = '" + dRow["TemplateTypeDescription"].ToString() + "' and IsCampaignDefault = 1", "", DataViewRowState.CurrentRows); string sDefaultValue = ""; if (dvDefault.Count > 0) { sDefaultValue = dvDefault[0]["PELTemplateID"].ToString(); } foreach (ListItem dItem in rblList.Items) { if (dItem.Value == sDefaultValue) { rblList.ClearSelection(); dItem.Selected = true; } } } }
protected void Page_Load(object sender, EventArgs e) { RadioButtonList = new RadioButtonList() { ID = "rbl", AutoPostBack = AutoPostBack, RepeatDirection = this.RepeatDirection, RepeatLayout = this.RepeatLayout }; BindToDataSource(RadioButtonList, false); RadioButtonList.DataBind(); if (!IsPostBack) { if (!string.IsNullOrEmpty(SelectedValue)) { this.RadioButtonList.Set(SelectedValue); } } else { SelectedValue = this.RadioButtonList.SelectedValue; } RadioButtonList.CssClass = FormElementCssClass; }
public void LlenaListaRbn(string SP, ref RadioButtonList ListBox, string parametro1, string parametro2, string valor1, string valor2) { try { List <Comun> Lista = new List <Comun>(); CD_Comun CDComun = new CD_Comun(); CDComun.LlenaLista(SP, ref Lista, parametro1, parametro2, valor1, valor2); ListBox.Items.Clear(); if (Lista.Count > 0) { ListBox.DataSource = Lista; ListBox.DataValueField = "IdStr"; ListBox.DataTextField = "Descripcion"; ListBox.DataBind(); } else { ListBox.Items.Add("La opción no contiene datos"); } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GridView_Criteria_RowDataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType == DataControlRowType.DataRow) { int ID = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grading_Type").ToString()); int Grade_Type = UDFLib.ConvertToInteger(DataBinder.Eval(e.Row.DataItem, "Grade_Type").ToString()); RadioButtonList rdo = (RadioButtonList)e.Row.FindControl("rdoOptions"); DataTable dt = objBLL.Get_GradingOptions(ID); if (Grade_Type == 2) { TextBox txtAnswer = new TextBox(); txtAnswer.Text = "Subjective Type"; txtAnswer.Enabled = false; e.Row.Cells[3].Controls.Add(txtAnswer); } if ((e.Row.RowState & DataControlRowState.Edit) > 0) { } else { rdo.DataSource = dt; rdo.DataBind(); } } } catch (Exception ex) { string jsSqlError2 = "alert('" + ex.Message + "');"; ScriptManager.RegisterStartupScript(this, this.GetType(), "jsSqlError2", jsSqlError2, true); } }
public static void rblListLlenaValoresConDT(DataTable pDT, ref RadioButtonList pchkl, string pValue, string pTextField) { pchkl.DataSource = pDT; pchkl.DataTextField = pTextField; pchkl.DataValueField = pValue; pchkl.DataBind(); }
public void Load_AllLoaiChamCong_RadioButtonList(RadioButtonList _rbl) { _rbl.DataSource = this.All.ToList(); _rbl.DataTextField = "LCCTen"; _rbl.DataValueField = "LCCID"; _rbl.DataBind(); }
public void fillRadioList(RadioButtonList rdList, DataTable dt, string selectedID, string textColumnName, string valueColumnName) { rdList.SelectedIndex = -1; if (dt.Rows.Count > 0) { rdList.DataSource = dt; if (valueColumnName != null && valueColumnName != "") { rdList.DataValueField = valueColumnName; } else { rdList.DataValueField = textColumnName; } rdList.DataTextField = textColumnName; rdList.DataBind(); ListItem li = rdList.Items.FindByValue(selectedID); if (li != null) { li.Selected = true; } else { rdList.Items[0].Selected = true; } } /*else * { * rdList.Items.Insert(0,new ListItem("--No Value--","0")); * }*/ }
protected void btnConfirm_Click(object sender, EventArgs e) { int routineID = Convert.ToInt32(rbl.SelectedItem.Value); Routine rtn = routManager.changeRoutineName(routineID, tbRoutineName.Text); int index = rbl.SelectedIndex; if (rtn != null) { rbl = (RadioButtonList)this.Parent.FindControl("rblRoutines"); rbl.DataSource = routManager.viewRoutines().ToList(); rbl.DataTextField = "name"; rbl.DataValueField = "id"; rbl.DataBind(); rbl.SelectedIndex = index; } }
//输出一个字段 //li_tdnums_onerow:当前行已输出了几列 //li_colnums_show:每行显示几列(标准情况下) //pi_isnewdoc 0:新文档 1:旧文档 //ifhavarole:表单上是否有权限 0:lable输出 1:input输出 //ifflowdoc:是否流程表单 0:非流程 1:流程 //curtacheid:当前环节ID,用于判断字段是否在当前环节有权限 public int GetFieldHtml(TableRow tRow, int li_tdnums_onerow, int li_colnums_show, string hy_fieldid, string pi_isnewdoc, string ifhavarole, string ifflowdoc, string curtacheid) { int li_return = li_tdnums_onerow; string ls_laborinput = "0"; //输出LABLE还是INPUT 0:LABLE 1:INPUT HyoaClass.Hyoa_global Hyoa_global = new HyoaClass.Hyoa_global(); HyoaClass.Hyoa_flowfield Hyoa_flowfield = new HyoaClass.Hyoa_flowfield(); DataTable dtfield = Hyoa_flowfield.GetSQLfieldBymudelidAndFieldidAndTableid(this.hy_mudelid.Text, hy_fieldid, this.hy_tableid.Text); int li_left = 30; int li_right = 70; if (dtfield.Rows.Count > 0) { string field_type = dtfield.Rows[0]["hy_fieldtype"].ToString(); //字段类型 if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "5") //如果设置了不显示左侧说明文字,则不加载左侧列 { li_return += 1; //插入单元格(左侧) TableCell tCell = new TableCell(); tRow.Cells.Add(tCell); tCell.Width = Unit.Percentage((li_left / li_colnums_show)); tCell.Height = Unit.Pixel(30); tCell.CssClass = "Tdcellleft"; tCell.HorizontalAlign = HorizontalAlign.Center; tCell.Controls.Add(new LiteralControl(dtfield.Rows[0]["hy_fieldname"].ToString())); } else { li_left = 50; li_right = 50; } //插入单元格(右侧) TableCell tCell2 = new TableCell(); tRow.Cells.Add(tCell2); tCell2.Width = Unit.Percentage((li_right / li_colnums_show)); tCell2.Height = Unit.Pixel(30); tCell2.CssClass = "Tdcellright"; if (dtfield.Rows[0]["hy_align"].ToString() == "left") { tCell2.HorizontalAlign = HorizontalAlign.Left; } if (dtfield.Rows[0]["hy_align"].ToString() == "center") { tCell2.HorizontalAlign = HorizontalAlign.Center; } if (dtfield.Rows[0]["hy_align"].ToString() == "right") { tCell2.HorizontalAlign = HorizontalAlign.Right; } tCell2.ColumnSpan = int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); li_return += int.Parse(dtfield.Rows[0]["hy_tdnums"].ToString()); //赋值(新文档取配置的默认值,旧文档取数据库表中的值) string field_docvalue = ""; if (pi_isnewdoc == "0") //新文档 { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() != "-1") { if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "0") { field_docvalue = dtfield.Rows[0]["hy_defaultvalue"].ToString(); //手工配置 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "1") { DataTable dt_getfieldvalue = Hyoa_global.GetDataTable(dtfield.Rows[0]["hy_defaultvalue"].ToString()); field_docvalue = dt_getfieldvalue.Rows[0][0].ToString(); //SQL语句 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "2") { field_docvalue = Session[dtfield.Rows[0]["hy_defaultvalue"].ToString()].ToString(); //SESSION } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "3") { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd"); //当前时间 else field_docvalue = System.DateTime.Now.ToString("yyyy-MM-dd HH:MM:ss"); //当前时间 } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "4") { //自动生成 if (dtfield.Rows[0]["hy_fieldtype"].ToString() == "数值") { //得到目前最大的数值,然后+1,未找到则赋值为1 DataTable dt_autovalue = Hyoa_global.GetDataTable("select max(hyc_" + hy_fieldid + ") maxint from hyc_" + this.hy_tableid.Text); if (dt_autovalue.Rows[0]["maxint"].ToString() == null || dt_autovalue.Rows[0]["maxint"].ToString() == "") field_docvalue += "1"; else field_docvalue += (System.Int32.Parse(dt_autovalue.Rows[0]["maxint"].ToString()) + 1).ToString(); } else { field_docvalue += System.Guid.NewGuid().ToString(); } } if (dtfield.Rows[0]["hy_defaultvaluetype"].ToString() == "5") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } } else { if (field_type == "文本" || field_type == "多行文本" || field_type == "多行文本_TEXT" || field_type == "文本加按钮" || field_type == "多行文本加按钮" || field_type == "日期" || field_type == "数值" || field_type == "对话框列表" || field_type == "复选框" || field_type == "单选框" || field_type == "口令" || field_type == "编辑器") { string ls_sql = "select hyc_" + hy_fieldid + " from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getdocvalue = Hyoa_global.GetDataTable(ls_sql); if (dt_getdocvalue.Rows.Count > 0) { field_docvalue = dt_getdocvalue.Rows[0][0].ToString(); if (field_type == "日期") { if (field_docvalue.Length > 8) { if (field_docvalue.Substring(0, 8) == "1900-1-1") { field_docvalue = " "; } else { if (dtfield.Rows[0]["hy_defaultvalue"].ToString() == "yyyy-mm-dd") { field_docvalue = System.DateTime.Parse(field_docvalue).ToString("yyyy-MM-dd"); } } } } } } if (field_type == "说明文字") { field_docvalue += dtfield.Rows[0]["hy_defaultvalue"].ToString(); } } //判断是输出LABL还是INPUT if (pi_isnewdoc == "0") //新文档 { if (ifflowdoc == "0") //非流程 { if (ifhavarole == "1") //有权限 { ls_laborinput = "1"; } } else { if (ifhavarole == "1") //有权限 { //有流程(判断当前环节这个字段是否有权限) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); if (ls_laborinput == "0") { field_docvalue = ""; } } else { field_docvalue = ""; } } } else //旧文档 { if (ifflowdoc == "0") //非流程 { if (ifhavarole == "1") //有权限 { ls_laborinput = "1"; //如果文档已经确认,则输出lable string ls_sql = "select hy_ifconfirm from hyc_" + this.hy_tableid.Text + " where DOCID='" + this.txtdocid.Value + "'"; DataTable dt_getifconfirm = Hyoa_global.GetDataTable(ls_sql); if (dt_getifconfirm.Rows.Count > 0) { if (dt_getifconfirm.Rows[0]["hy_ifconfirm"].ToString() == "1") ls_laborinput = "0"; } } } else { if (ifhavarole == "1") //有权限 { //有流程(判断当前环节这个字段是否有权限) HyoaClass.Hyoa_flowtachefield Hyoa_flowtachefield = new HyoaClass.Hyoa_flowtachefield(); ls_laborinput = Hyoa_flowtachefield.IfHaveRolebyflowidandtacheidandfieldid(hy_flowid.Text, curtacheid, hy_fieldid); //如果流程结束了,则输出lable if (hy_curtacheid.Text == "**") { ls_laborinput = "0"; } } } } //如果是输出LABLE,值为空则赋为 不为空时需要转换回车和空格 if (ls_laborinput == "0") { if (field_docvalue == "") { field_docvalue = " "; } else { if (field_type != "编辑器") { field_docvalue = RtfToText(field_docvalue); } } } //单行文本 if (field_type == "文本") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //多行文本 if (field_type == "多行文本") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //多行文本_TEXT if (field_type == "多行文本_TEXT") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //按钮 if (field_type == "按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //一直显示的按钮 if (field_type == "一直显示的按钮") { //-----开始输出字段------ Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value='" + dtfield.Rows[0]["hy_fieldname"].ToString() + "' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } //日期 if (field_type == "日期") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //文本加按钮 if (field_type == "文本加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } txtTextBox.Width = Unit.Parse("60%"); if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //多行文本加按钮 if (field_type == "多行文本加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //意见加按钮 if (field_type == "意见加按钮") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.MultiLine; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } //txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); Label txtTextBox2 = new Label(); txtTextBox2.ID = "span_" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "' value=' 选 择 ' class=btn3 onclick=\"" + dtfield.Rows[0]["hy_onclick"].ToString() + "\" /><input type=button id='btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "_cz' value=' 重 置 ' class=btn3 onclick=\"document.getElementById('" + dtfield.Rows[0]["hy_fieldid"].ToString() + "').value='';\" />"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //数值 if (field_type == "数值") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //对话框列表(下拉框 if (field_type == "对话框列表") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { DropDownList ddlDropDownList = new DropDownList(); ddlDropDownList.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { ddlDropDownList.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { ddlDropDownList.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { ddlDropDownList.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { ddlDropDownList.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 if (dtfield.Rows[0]["hy_options"].ToString() != "") { //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); ddlDropDownList.DataSource = dt_options; ddlDropDownList.DataTextField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataValueField = dt_options.Columns[0].ColumnName; ddlDropDownList.DataBind(); } } ddlDropDownList.Items.Insert(0, new ListItem("--请选择--", "")); ddlDropDownList.SelectedValue = field_docvalue; tCell2.Controls.Add(ddlDropDownList); } } //复选框(查询时直接显示文本框) if (field_type == "复选框") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { CheckBoxList txtTextBox = new CheckBoxList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } if (field_docvalue != "") { field_docvalue = "," + field_docvalue + ","; foreach (ListItem li in txtTextBox.Items) { if (field_docvalue.Contains(li.Value)) li.Selected = true; } } tCell2.Controls.Add(txtTextBox); } } //单选框(查询时直接显示文本框) if (field_type == "单选框") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { RadioButtonList txtTextBox = new RadioButtonList(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "0") { //手工配置 if (dtfield.Rows[0]["hy_options"].ToString() != "") { string[] lv_options = dtfield.Rows[0]["hy_options"].ToString().Split('#'); for (int i = 0; i < lv_options.Length; i++) { txtTextBox.Items.Add(lv_options[i].ToString()); } } } if (dtfield.Rows[0]["hy_optiontype"].ToString() == "1") { //SQL语句 //如果SQL语句中含有特殊标示,则需要替换 string ls_sql = dtfield.Rows[0]["hy_options"].ToString(); if (ls_sql.Contains("用户ID")) { ls_sql = ls_sql.Replace("用户ID", "'" + Session["hyuid"].ToString() + "'"); } if (ls_sql.Contains("用户名")) { ls_sql = ls_sql.Replace("用户名", "'" + Session["hyuname"].ToString() + "'"); } if (ls_sql.Contains("部门ID")) { ls_sql = ls_sql.Replace("部门ID", "'" + Session["hydeptid"].ToString() + "'"); } if (ls_sql.Contains("部门名")) { ls_sql = ls_sql.Replace("部门名", "'" + Session["hydeptname"].ToString() + "'"); } if (dtfield.Rows[0]["hy_options"].ToString() != "") { DataTable dt_options = Hyoa_global.GetDataTable(ls_sql); txtTextBox.DataSource = dt_options; txtTextBox.DataTextField = dt_options.Columns[0].ColumnName; txtTextBox.DataValueField = dt_options.Columns[0].ColumnName; txtTextBox.DataBind(); } } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //口令 if (field_type == "口令") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = " "; tCell2.Controls.Add(txtTextBox); } else { TextBox txtTextBox = new TextBox(); txtTextBox.TextMode = TextBoxMode.Password; txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (dtfield.Rows[0]["hy_ifreadonly"].ToString() == "是") { txtTextBox.ReadOnly = true; } if (dtfield.Rows[0]["hy_class"].ToString() != "") { txtTextBox.CssClass = dtfield.Rows[0]["hy_class"].ToString(); } if (dtfield.Rows[0]["hy_width"].ToString() != "") { txtTextBox.Width = Unit.Parse(dtfield.Rows[0]["hy_width"].ToString()); } if (dtfield.Rows[0]["hy_height"].ToString() != "") { txtTextBox.Height = Unit.Parse(dtfield.Rows[0]["hy_height"].ToString()); } if (dtfield.Rows[0]["hy_onclick"].ToString() != "") { txtTextBox.Attributes.Add("onclick", dtfield.Rows[0]["hy_onclick"].ToString()); } if (dtfield.Rows[0]["hy_ondblclick"].ToString() != "") { txtTextBox.Attributes.Add("ondblclick", dtfield.Rows[0]["hy_ondblclick"].ToString()); } if (dtfield.Rows[0]["hy_onchange"].ToString() != "") { txtTextBox.Attributes.Add("onchange", dtfield.Rows[0]["hy_onchange"].ToString()); } if (dtfield.Rows[0]["hy_onkeydown"].ToString() != "") { txtTextBox.Attributes.Add("onkeydown", dtfield.Rows[0]["hy_onkeydown"].ToString()); } if (dtfield.Rows[0]["hy_onkeyup"].ToString() != "") { txtTextBox.Attributes.Add("onkeyup", dtfield.Rows[0]["hy_onkeyup"].ToString()); } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //附件组件 if (field_type == "附件组件") { //读取附件内容 HyoaClass.Hyoa_fileatt Hyoa_fileatt = new HyoaClass.Hyoa_fileatt(); DataTable dt_fileatt = Hyoa_fileatt.GetfileattByFatheridandFatherfield(this.txtdocid.Value, hy_fieldid); field_docvalue = ""; if (dt_fileatt.Rows.Count > 0) { for (var ii = 0; ii < dt_fileatt.Rows.Count; ii++) { field_docvalue += (ii + 1).ToString() + "、<a href=\"" + dt_fileatt.Rows[ii]["hy_filepath"].ToString() + "\" target=_blank>" + dt_fileatt.Rows[ii]["hy_filename"].ToString() + "</a><br />"; } } //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); if (field_docvalue == "") { field_docvalue = " "; } txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue += "<input type=button id='uploadfile1' value='附件管理' class=btn3 onclick=\"window.open('ggdy/main_fileatt.aspx?fatherid=" + this.txtdocid.Value + "&fatherfield=" + hy_fieldid + "','filewindow','height=350,width=600,top=100,left=200,toolbar=no,menubar=no,scrollbars=no, resizable=no,location=no, status=no');\" />"; txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //说明文字 if (field_type == "说明文字") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //编辑器 if (field_type == "编辑器") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { //隐藏文本框 TextBox txtTextBox = new TextBox(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; txtTextBox.Style.Value = "display:none"; tCell2.Controls.Add(txtTextBox); //编辑器 Label txtTextBox2 = new Label(); txtTextBox2.ID = "eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString(); field_docvalue = "<iframe ID=\"eWebEditor" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"system/eWebEditor/ewebeditor.htm?id=" + dtfield.Rows[0]["hy_fieldid"].ToString() + "&style=Portal\" frameborder=0 scrolling=no width=" + dtfield.Rows[0]["hy_width"].ToString() + " height=" + dtfield.Rows[0]["hy_height"].ToString() + "></iframe>"; txtTextBox2.Text = field_docvalue; tCell2.Controls.Add(txtTextBox2); } } //痕迹保留 if (field_type == "痕迹保留") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/readoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; //如果是流程模块,则根据环节判断一下 if (ifflowdoc == "1") { //判断是否为第一环节 HyoaClass.Hyoa_flowwork Hyoa_flowwork = new HyoaClass.Hyoa_flowwork(); DataTable dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, "*"); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == this.hy_curtacheid.Text) { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=1&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { //判断是否为最后一个环节 dtflowwork.Clear(); dtflowwork = Hyoa_flowwork.Getflowworkbyflowidtacheid(this.hy_flowid.Text, this.hy_curtacheid.Text); if (dtflowwork.Rows.Count > 0) { if (dtflowwork.Rows[0]["hy_nexttacheid"].ToString() == "**") { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=1&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } else { field_docvalue = "<input type=button id=\"btn_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" value='正 文' class=btn3 onclick=\"window.open('ntko/editoffice.aspx?newofficetype=1&fatherid=" + this.txtdocid.Value + "&tableid=" + this.hy_tableid.Text + "&tacheByhj=0&jsxd=0&rnd='+Math.random(),'hjblwindow','height=768,width=1024,top=0,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=yes,location=no, status=no');\" /> "; } } } } } Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //IFRAME列表 if (field_type == "IFRAME列表") { //-----开始输出字段------ if (ls_laborinput == "0") //输出LABLE { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=0\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } else { field_docvalue = "<iframe id=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" name=\"ifr_" + dtfield.Rows[0]["hy_fieldid"].ToString() + "\" src=\"" + dtfield.Rows[0]["hy_defaultvalue"].ToString() + "&motherid=" + this.txtdocid.Value + "&ishaverole=1\" frameborder=\"0\" scrolling=\"yes\" height=\"80px\" width=\"98%\"></iframe>"; Label txtTextBox = new Label(); txtTextBox.ID = dtfield.Rows[0]["hy_fieldid"].ToString(); txtTextBox.Text = field_docvalue; tCell2.Controls.Add(txtTextBox); } } //子表信息带链接 //子表信息不带链接 } return li_return; }
public static RadioButtonList FillWygladDropDownList(RadioButtonList DDLWyglad) { SqlConnection con = new SqlConnection(Usr.ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("SELECT budowa_ciala_id, budowa_ciala_opis FROM Budowa", con); try { SqlDataReader reader = cmd.ExecuteReader(); DDLWyglad.DataSource = reader; DDLWyglad.DataTextField = "budowa_ciala_opis"; DDLWyglad.DataValueField = "budowa_ciala_id"; DDLWyglad.DataBind(); } catch (Exception ex) { HttpContext.Current.Trace.Write(ex.Message); } finally { con.Close(); } return DDLWyglad; }
//================================================= //功能描述:对RadioButtonList进行数据绑定,无排序 //输入参数:sql,查询的SQL语句;dg,需要绑定的DATAGRID控件 //返回值:无 //时间:2013.08.20 //================================================= public static void bindRadioButtonList(string sql, RadioButtonList rl, string class_name, string id) { DataSet ds = getdataset(sql); rl.DataSource = ds.Tables[0].DefaultView; rl.DataTextField = class_name; rl.DataValueField = id; rl.SelectedIndex = 0; closeConnection(); rl.DataBind(); }
public static DataSet BindBody_Complextion(RadioButtonList ddlBodyType, RadioButtonList ddlComplexton) { try { DataSet ds2 = DbManager.GetDataSet("Select * From tblBodyType"); ddlBodyType.DataSource = ds2; ddlBodyType.DataTextField = "Body_Type"; ddlBodyType.DataValueField = "Body_Type_Code"; ddlBodyType.DataBind(); DataSet ds3 = DbManager.GetDataSet("Select * From tblBodyComplexion"); ddlComplexton.DataSource = ds3; ddlComplexton.DataTextField = "Complexion"; ddlComplexton.DataValueField = "Complexion_Id"; ddlComplexton.DataBind(); return ds2; } catch (Exception ex) { throw; } }
/*Sub Header*********************************************************** Function Name: BindCompanyStatusDropdown Functionality: This function is used to bind the company statuses with the predefined array Input: dropdownlist and the strInitialText Output: Note: *********************************************************************/ public static void BindCompanyStatusRadioButtonList(RadioButtonList rdoList, string strInitialText) { rdoList.DataSource = BindCompanyStatus(); rdoList.DataTextField = "Value"; rdoList.DataValueField = "Key"; rdoList.DataBind(); }
public static void BindFoodDrinkSmoke(RadioButtonList ddlFood, RadioButtonList ddlDrink, RadioButtonList ddlSmoke) { try { DataSet ds1 = DbManager.GetDataSet("Select * From tblDrink"); ddlDrink.DataSource = ds1; ddlDrink.DataTextField = "Drink"; ddlDrink.DataValueField = "Drink_Id"; ddlDrink.DataBind(); DataSet ds2 = DbManager.GetDataSet("Select * From tblDrink"); ddlSmoke.DataSource = ds2; ddlSmoke.DataTextField = "Drink"; ddlSmoke.DataValueField = "Drink_Id"; ddlSmoke.DataBind(); DataSet ds3 = DbManager.GetDataSet("Select * From tblDiet"); ddlFood.DataSource = ds3; ddlFood.DataTextField = "Diet"; ddlFood.DataValueField = "Diet_Id"; ddlFood.DataBind(); } catch (Exception ex) { throw; } }
protected void Page_Load(object sender, EventArgs e) { sysManager = new SystemExerciseManager(); routManager = new routineManager(); if (Session["exercises"] == null) { exercises = new List<Exercise>(); Session["exercises"] = exercises; } if (!IsPostBack) { // full refresh of page will abandon current session Session.Abandon(); rbl = (RadioButtonList)this.Parent.FindControl("rblRoutines"); if (userID != null) { rbl.DataSource = routManager.getUsersRoutines(userID).ToList(); rbl.DataTextField = "name"; rbl.DataValueField = "id"; rbl.DataBind(); } // to get the id of the button so that enter = submit tbRoutineName.Attributes.Add("onKeyPress", "doClick('" + btnConfirm.ClientID + "',event)"); } }