protected void UpdateListViewHeader() { CultureInfo ivCEn = new CultureInfo("en-US"); Label lblMon = this.lvStage.Controls[0].FindControl("lblMon") as Label; if (lblMon != null) { lblMon.Text = Monday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblTue = this.lvStage.Controls[0].FindControl("lblTue") as Label; if (lblTue != null) { lblTue.Text = Tuesday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblWed = this.lvStage.Controls[0].FindControl("lblWed") as Label; if (lblWed != null) { lblWed.Text = Wednesday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblThu = this.lvStage.Controls[0].FindControl("lblThu") as Label; if (lblThu != null) { lblThu.Text = Thursday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblFri = this.lvStage.Controls[0].FindControl("lblFri") as Label; if (lblFri != null) { lblFri.Text = Friday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblSat = this.lvStage.Controls[0].FindControl("lblSat") as Label; if (lblSat != null) { lblSat.Text = Saturday.ToString("ddd </br> dd-MMM-yy", ivCEn); } Label lblSun = this.lvStage.Controls[0].FindControl("lblSun") as Label; if (lblSun != null) { lblSun.Text = Sunday.ToString("ddd </br> dd-MMM-yy", ivCEn); } }
protected void lvStage_ItemDataBound(object sender, ListViewItemEventArgs e) { if (lvStage.EditIndex >= 0) { ListViewDataItem dataItem = (ListViewDataItem)e.Item; if (dataItem.DisplayIndex == lvStage.EditIndex) { DropDownList ddl = (DropDownList)e.Item.FindControl("ddlPrjTaskEdit"); if (ddl != null) { string lsPrjCode = ((Label)e.Item.FindControl("lblPrjCodeEdit")).Text; string lsSAPB1DB = ((Label)e.Item.FindControl("lblSAPB1DBEdit")).Text; ddl.DataSource = dsPrjList.Tables[0]; ddl.DataTextField = "PrjName"; ddl.DataValueField = "PrjCode"; ddl.DataBind(); if (!lsPrjCode.Equals("") && !lsSAPB1DB.Equals("")) ddl.SelectedValue = lsPrjCode + ";" + lsSAPB1DB; } DropDownList ddlPhase = (DropDownList)e.Item.FindControl("ddlPhaseEdit"); if (ddlPhase != null) { if (ddlPhase.Items.FindByValue(msPhase) != null) { ddlPhase.Items.FindByValue(msPhase).Selected = true; msPhase = string.Empty; } else ddlPhase.SelectedIndex = 0; } TextBox txtMon = (TextBox)e.Item.FindControl("txtMonEdit"); TextBox txtTue = (TextBox)e.Item.FindControl("txtTueEdit"); TextBox txtWed = (TextBox)e.Item.FindControl("txtWedEdit"); TextBox txtThu = (TextBox)e.Item.FindControl("txtThuEdit"); TextBox txtFri = (TextBox)e.Item.FindControl("txtFriEdit"); TextBox txtSat = (TextBox)e.Item.FindControl("txtSatEdit"); TextBox txtSun = (TextBox)e.Item.FindControl("txtSunEdit"); TextBox txtSrvType = (TextBox)e.Item.FindControl("txtSrvTypeEdit"); TextBox txtTimeEndDate = (TextBox)e.Item.FindControl("txtTimeEndDateEdit"); txtMon.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtMon.ClientID + "', '" + txtSrvType.Text + "', '" + Monday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtTue.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtTue.ClientID + "', '" + txtSrvType.Text + "', '" + Tuesday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtWed.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtWed.ClientID + "', '" + txtSrvType.Text + "', '" + Wednesday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtThu.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtThu.ClientID + "', '" + txtSrvType.Text + "', '" + Thursday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtFri.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtFri.ClientID + "', '" + txtSrvType.Text + "', '" + Friday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtSat.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtSat.ClientID + "', '" + txtSrvType.Text + "', '" + Saturday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); txtSun.Attributes.Add("onKeyUp", "txtOnKeyPress( '" + txtSun.ClientID + "', '" + txtSrvType.Text + "', '" + Sunday.ToString("yyyyMMdd") + "', '" + txtTimeEndDate.Text + "' )"); } //mbVisible = true; System.Web.UI.HtmlControls.HtmlTableCell td = (System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("tdButtons"); if (td != null) td.Visible = true; } else { if (e.Item.ItemType == ListViewItemType.DataItem) { System.Web.UI.HtmlControls.HtmlTableCell td = (System.Web.UI.HtmlControls.HtmlTableCell)e.Item.FindControl("tdButtons"); if (td != null) td.Visible = btnAddRecord.Enabled; } } }