コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (IsPostBack)
            return;

        if (Request.QueryString["ID"] != null)
        {
            if (Request.QueryString["ID"] == "True")
            {
                lblMsg.Text = "Successfully Edited";
            }
        }

        if (Request.QueryString["ColorId"] != null)
        {
            int colorId = Convert.ToInt32(Request.QueryString["ColorId"].ToString());
            dtColors = taColors.SelectColorbyColorId(colorId);
            if (dtColors.Rows.Count > 0)
            {
                txtTitle.Text = dtColors[0].ColorTitle.ToString();
                txtHexaCode.Text = dtColors[0].HexaCode.ToString();
            }
        }
        else
        {
            tblColor.Visible = false;
            lblMsg.Text = "No Record Found";
        }
    }
コード例 #2
0
 protected void LoadColors()
 {
     dtColors = taColors.SelectAllColors();
     if (dtColors.Rows.Count > 0)
     {
         ddlColors.DataSource = dtColors;
         ddlColors.DataTextField = dtColors.Columns[1].ToString();
         ddlColors.DataValueField = dtColors.Columns[0].ToString();
         ddlColors.DataBind();
         ddlColors.Items.Insert(0, new ListItem("Please Select", ""));
     }
 }
コード例 #3
0
    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            LinkButton btnDel = (LinkButton)e.Row.FindControl("delbutton");
            btnDel.Attributes.Add("OnClick", "return confirm('Are you sure to delete this record?');");

            Label lblColorId = (Label)e.Row.FindControl("lblColorId");
            Label lblProductId = (Label)e.Row.FindControl("lblProductId");

            dtProduct = taProduct.SelectProductNamebyProductId(Convert.ToInt32(lblProductId.Text));
            if (dtProduct.Rows.Count > 0)
            {
                lblProductId.Text = dtProduct[0].ProductTitle.ToString();
            }
            dtColors = taColors.SelectColorTitlebyColorId(Convert.ToInt32(lblColorId.Text));
            if (dtColors.Rows.Count > 0)
                lblColorId.Text = dtColors[0].ColorTitle.ToString();

        }
    }
コード例 #4
0
ファイル: Colors.aspx.cs プロジェクト: asgharlatif/HSSWebSite
 private void BindData()
 {
     dtColors = taColors.SelectAllColors();
     if (dtColors.Rows.Count > 0)
     {
         GridView1.DataSource = dtColors;
         GridView1.DataBind();
     }
     else
     {
         GridView1.Visible = false;
         lblMsg.Text = "No record found";
     }
 }