Пример #1
0
    protected void Gridview_4_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView theGrid      = sender as GridView; // refer to the GridView
        int      newPageIndex = 0;

        if (-2 == e.NewPageIndex)
        {
            TextBox     txtNewPageIndex = null;
            GridViewRow pagerRow        = Gridview4.BottomPagerRow;


            if (null != pagerRow)
            {
                txtNewPageIndex = (TextBox)pagerRow.FindControl("textbox");  // refer to the TextBox with the NewPageIndex value
            }

            if (null != txtNewPageIndex && txtNewPageIndex.Text != "")
            {
                newPageIndex = int.Parse(txtNewPageIndex.Text) - 1; // get the NewPageIndex
            }
        }
        else
        {
            newPageIndex = e.NewPageIndex;
        }
        string condition = "and PT_ID='" + new Guid(label_PT_ID.Text) + "'";

        BindGridview4(condition);
        newPageIndex        = newPageIndex < 0 ? 0 : newPageIndex;
        newPageIndex        = newPageIndex >= Gridview4.PageCount ? Gridview4.PageCount - 1 : newPageIndex;
        Gridview4.PageIndex = newPageIndex;
        Gridview4.DataBind();
    }
Пример #2
0
    private void ESetInitialRow()
    {
        DataTable dt = new DataTable();
        DataRow   dr = null;


        dt.Columns.Add(new DataColumn("txtTeacherG1", typeof(string)));
        dt.Columns.Add(new DataColumn("txtFatherNameG1", typeof(string)));
        dt.Columns.Add(new DataColumn("txtDoBG1", typeof(string)));
        dt.Columns.Add(new DataColumn("txtQualificationG1", typeof(string)));



        dr = dt.NewRow();


        dr["txtTeacherG1"]       = string.Empty;
        dr["txtFatherNameG1"]    = string.Empty;
        dr["txtDoBG1"]           = string.Empty;
        dr["txtQualificationG1"] = string.Empty;



        dt.Rows.Add(dr);
        //dr = dt.NewRow();

        //Store the DataTable in ViewState
        ViewState["CurrentTable1"] = dt;

        Gridview4.DataSource = dt;
        Gridview4.DataBind();
    }
Пример #3
0
    private void ESetPreviousData()
    {
        int rowIndex = 0;


        Gridview4.DataSource = ViewState["CurrentTable1"] as DataTable;
        Gridview4.DataBind();


        if (ViewState["CurrentTable1"] != null)
        {
            DataTable dt = (DataTable)ViewState["CurrentTable1"];
            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    TextBox box1 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtTeacherG1");
                    TextBox box2 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtFatherNameG1");
                    TextBox box3 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtDoBG1");
                    TextBox box4 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtQualificationG1");



                    box1.Text = dt.Rows[i]["txtTeacherG1"].ToString();
                    box2.Text = dt.Rows[i]["txtFatherNameG1"].ToString();
                    box3.Text = dt.Rows[i]["txtDoBG1"].ToString();
                    box4.Text = dt.Rows[i]["txtQualificationG1"].ToString();



                    rowIndex++;
                }
            }
        }
    }
Пример #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        GridView_bom.DataSource = wol.S_ProType_BOM(LabelPT_Name.Text);
        GridView_bom.DataBind();

        GridView_Pr.DataSource = wol.S_WO_ProType_ProcessRoute(LabelPT_Name.Text, 0);
        GridView_Pr.DataBind();

        string condition = "and PT_ID='" + new Guid(Request.QueryString["PT_ID"]) + "'";

        Gridview4.DataSource = psd.SelectPTCountersign(condition);
        Gridview4.DataBind();
        DataSet ds = psd.SelectProType_Special(condition);

        LabelPT_SpecialCode.Text     = ds.Tables[0].Rows[0]["PT_SpecialCode"].ToString();
        LabelPT_Name.Text            = ds.Tables[0].Rows[0]["PT_Name"].ToString();
        LabelPT_SpecialNeed.Text     = ds.Tables[0].Rows[0]["PT_SpecialNeed"].ToString();
        LabelPT_SpecialTypeMan.Text  = ds.Tables[0].Rows[0]["PT_SpecialTypeMan"].ToString();
        LabelPT_SpecialTypeTime.Text = ds.Tables[0].Rows[0]["PT_SpecialTypeTime"].ToString();
        LabelPT_CSate.Text           = ds.Tables[0].Rows[0]["PT_CSate"].ToString();
        TextBoxLabelPT_Note.Text     = ds.Tables[0].Rows[0]["PT_Note"].ToString();

        try
        {
            LabelPrint.Text = Session["UserName"].ToString();
        }
        catch
        {
            Response.Redirect("~/Default.aspx");
        }
        LabelTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm");
    }
Пример #5
0
    private void EAddNewRowToGrid()
    {
        int rowIndex = 0;

        if (ViewState["CurrentTable1"] != null)
        {
            DataTable dtCurrentTable = (DataTable)ViewState["CurrentTable1"];
            DataRow   drCurrentRow   = null;
            if (dtCurrentTable.Rows.Count > 0)
            {
                for (int i = 1; i <= dtCurrentTable.Rows.Count; i++)
                {
                    //extract the TextBox values


                    TextBox box1 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtTeacherG1");
                    TextBox box2 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtFatherNameG1");
                    TextBox box3 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtDoBG1");
                    TextBox box4 = (TextBox)Gridview4.Rows[rowIndex].Cells[1].FindControl("txtQualificationG1");



                    drCurrentRow = dtCurrentTable.NewRow();
                    //drCurrentRow["RowNumber"] = i + 1;

                    dtCurrentTable.Rows[i - 1]["txtTeacherG1"]       = box1.Text;
                    dtCurrentTable.Rows[i - 1]["txtFatherNameG1"]    = box2.Text;
                    dtCurrentTable.Rows[i - 1]["txtDoBG1"]           = box3.Text;
                    dtCurrentTable.Rows[i - 1]["txtQualificationG1"] = box4.Text;


                    rowIndex++;
                }
                dtCurrentTable.Rows.Add(drCurrentRow);
                ViewState["CurrentTable1"] = dtCurrentTable;

                Gridview4.DataSource = dtCurrentTable;
                Gridview4.DataBind();
            }
        }
        else
        {
            Response.Write("ViewState is null");
        }

        //Set Previous Data on Postbacks
        ESetPreviousData();
    }
Пример #6
0
    protected void BindTheData()
    {
        //Response.Write("<script>alert('Binding...')</script>");

        // Gridview1.DataSource = SqlDataSource1;
        //Gridview1.DataBind();

        Gridview2.DataSource = SqlDataSource2;
        Gridview2.DataBind();

        Gridview3.DataSource = SqlDataSource3;
        Gridview3.DataBind();

        Gridview4.DataSource = SqlDataSource4;
        Gridview4.DataBind();
    }
Пример #7
0
    protected void BindTheData()
    {
        //Response.Write("<script>alert('Binding...')</script>");

        // Gridview1.DataSource = SqlDataSource1;
        //Gridview1.DataBind();


        lblStaffName.Text    = DropDownList1.SelectedItem.Text;
        Gridview2.DataSource = SqlDataSource2;
        Gridview2.DataBind();

        Gridview3.DataSource = SqlDataSource3;
        Gridview3.DataBind();

        Gridview4.DataSource = SqlDataSource4;
        Gridview4.DataBind();
    }
Пример #8
0
 protected void BindGridview4(string condition)
 {
     Gridview4.DataSource = psd.SelectPTCountersign(condition);
     Gridview4.DataBind();
 }
Пример #9
0
 //加工价格表绑定
 private void BindGridview4(PMCopperFoundryinfo PMCopperFoundryinfo)
 {
     Gridview4.DataSource = pf.SelectPMCopperProcess(PMCopperFoundryinfo);
     Gridview4.DataBind();
 }