<asp:GridView ID="grid_planningStaff" runat="server" AutoGenerateColumns="false" CssClass="table_style01 table100" BorderWidth="3px" ForeColor="Black" OnRowCommand="grid_planning_OnRowCommand" OnRowDataBound="grid_planning_RowdataBound"> <Columns> </Columns> </asp:GridView>
protected void grid_planning_RowdataBound(object sender, GridViewRowEventArgs e) { try { if (e.Row.RowType != DataControlRowType.Header) { DataSet ds = new DataSet(); planningStaffCommon.StaffID = sid; ds = objDALPlanningModule.GetStaffMeetingData(planningStaffCommon); if (ds.Tables[0].Rows.Count > 0) { for (int J = 0; J < ds.Tables[0].Rows.Count; J++) { dateofcell = Convert.ToString(ds.Tables[0].Rows[J]["FromDate"]); from = Convert.ToInt16(ds.Tables[0].Rows[J]["datea"]); string clientids = Convert.ToString(ds.Tables[0].Rows[J]["MeetingType"]); colorvalue = Convert.ToInt32(ds.Tables[0].Rows[J]["ColorValues"]); //set Color if (colorvalue == 1) { //DataSet dscolor = new DataSet(); //objDALPlanningModule._dtLOVDescription=clientids; //dscolor=objDALPlanningModule.GetParaMeterDetailsDAL(); //if (dscolor.Tables[0] != null) //{ // setcolor = Convert.ToString(dscolor.Tables[0].Rows[0]["Value"]); //} //else //{ //break //} if (clientids == "Test Value1") { setcolor = "GREEN"; } else if (clientids == "Testy Value2") { setcolor = "ORANGE"; } else { setcolor = "RED"; } } else { setcolor = "Aqua"; } //color and fill clients for (int i = from; i <= from; i++) { LinkButton lkBtn = new LinkButton(); lkBtn.ForeColor = Color.Black; lkBtn.Font.Underline = false; lkBtn.ID = "link_button" + i; lkBtn.Text = clientids; lkBtn.CommandArgument = "link_button"+i; lkBtn.CommandName = "Edit"; lkBtn. önClientClick = "Edit"; HiddenField hdndate = new HiddenField(); hdndate.ID = "hdn" + i; hdndate.Value = dateofcell; e.Row.Cells[i].Controls.Add(hdndate); e.Row.Cells[i].BackColor = Color.FromName(setcolor); e.Row.Cells[i].Controls.Add(lkBtn); } } } //hide other extra created rows for (int i = 1; i < grid_planningStaff.Rows.Count; i++) { grid_planningStaff.Rows[0].Visible = true; grid_planningStaff.Rows[i].Visible = false; } } } catch (Exception) { throw; } } protected void grid_planning_OnRowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Edit") { for (int i = 1; i < 32; i++) { HiddenField hdn = (HiddenField)grid_planningStaff.FindControl("hdn" + i); //LinkButton lnkdate = (LinkButton)grid_planningStaff.FindControl("hdn"+i); txt_fromDate.Text = hdn.Value; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)