Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/299.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 动态更新div数据 受保护的无效页面加载(对象发送方,事件参数e) { 如果(!IsPostBack) { 被提名人(); } 如果(转换为32(ddleemployee.SelectedValue)>0) { populaterininginfo(Convert.ToInt16(ddleemployee.SelectedValue)); } } 受保护的void btainingsave_Click(对象发送者,事件参数e) { 尝试 { 短empID=0; 如果(empID=0) { success=hrServer.addToEmpTraining(trainingNew,path); if(success.Equals(“success”)) { Msg=“已成功添加…”;} 其他的 { Msg=成功; } } 其他的 { } jsCall(“警报(“+Msg+”)”,this); 页面加载(空,空); } 捕获(例外情况除外) { WebUtil.MessageBox\u Show(例如Message,this); } } 私有void populaterininginfo(简称empID) { HumanResourceServer hrServer=新的HumanResourceServer(); DataSet TrainingFoers=hrServer.GetEmployeeTrainingInfo(empID); int i=0; int count=traininginfoers.Tables[0].Rows.count; ViewState[“TrainingInfo”]=TrainingFoers.Tables[0]; int k=0; DataTable dtTraining=TrainingFores.Tables[0]; 对于(i=0;i_C#_Asp.net_Pageload - Fatal编程技术网

C# 动态更新div数据 受保护的无效页面加载(对象发送方,事件参数e) { 如果(!IsPostBack) { 被提名人(); } 如果(转换为32(ddleemployee.SelectedValue)>0) { populaterininginfo(Convert.ToInt16(ddleemployee.SelectedValue)); } } 受保护的void btainingsave_Click(对象发送者,事件参数e) { 尝试 { 短empID=0; 如果(empID=0) { success=hrServer.addToEmpTraining(trainingNew,path); if(success.Equals(“success”)) { Msg=“已成功添加…”;} 其他的 { Msg=成功; } } 其他的 { } jsCall(“警报(“+Msg+”)”,this); 页面加载(空,空); } 捕获(例外情况除外) { WebUtil.MessageBox\u Show(例如Message,this); } } 私有void populaterininginfo(简称empID) { HumanResourceServer hrServer=新的HumanResourceServer(); DataSet TrainingFoers=hrServer.GetEmployeeTrainingInfo(empID); int i=0; int count=traininginfoers.Tables[0].Rows.count; ViewState[“TrainingInfo”]=TrainingFoers.Tables[0]; int k=0; DataTable dtTraining=TrainingFores.Tables[0]; 对于(i=0;i

C# 动态更新div数据 受保护的无效页面加载(对象发送方,事件参数e) { 如果(!IsPostBack) { 被提名人(); } 如果(转换为32(ddleemployee.SelectedValue)>0) { populaterininginfo(Convert.ToInt16(ddleemployee.SelectedValue)); } } 受保护的void btainingsave_Click(对象发送者,事件参数e) { 尝试 { 短empID=0; 如果(empID=0) { success=hrServer.addToEmpTraining(trainingNew,path); if(success.Equals(“success”)) { Msg=“已成功添加…”;} 其他的 { Msg=成功; } } 其他的 { } jsCall(“警报(“+Msg+”)”,this); 页面加载(空,空); } 捕获(例外情况除外) { WebUtil.MessageBox\u Show(例如Message,this); } } 私有void populaterininginfo(简称empID) { HumanResourceServer hrServer=新的HumanResourceServer(); DataSet TrainingFoers=hrServer.GetEmployeeTrainingInfo(empID); int i=0; int count=traininginfoers.Tables[0].Rows.count; ViewState[“TrainingInfo”]=TrainingFoers.Tables[0]; int k=0; DataTable dtTraining=TrainingFores.Tables[0]; 对于(i=0;i,c#,asp.net,pageload,C#,Asp.net,Pageload,aspx页面包含以下代码 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ResetEmpNominee(); } if (Convert.ToInt32(ddlEmployee.

aspx页面包含以下代码

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {                               
                ResetEmpNominee();               
        }
        if (Convert.ToInt32(ddlEmployee.SelectedValue) > 0)
        {  
              populateTrainingInfo(Convert.ToInt16(ddlEmployee.SelectedValue));
        }
    }


protected void btnTrainingSave_Click(object sender, EventArgs e)
    {
        try
        {

            short empID = 0;
            if (empID =0)
            {
                success = hrServer.addToEmpTraining(trainingNew, path);
                if (success.Equals("Success"))
                {
                    Msg = "Successfully Added...";                    }
                else
                {
                    Msg = success;
                }
            }
            else
            {

            }

            WebUtil.jsCall("alert('" + Msg + "')", this);


            Page_Load(null, null); 
        }
        catch (Exception ex)
        {
            WebUtil.MessageBox_Show(ex.Message, this);
        }

    }





private void populateTrainingInfo(short empID)
    {
        HumanResourceServer hrServer = new HumanResourceServer();
        DataSet trainingInfoes = hrServer.GetEmployeeTrainingInfo(empID);
        int i = 0;
        int count = trainingInfoes.Tables[0].Rows.Count;
        ViewState["TrainingInfo"] = trainingInfoes.Tables[0];
        int k = 0;
        DataTable dtTraining = trainingInfoes.Tables[0];
        for (i = 0; i < dtTraining.Rows.Count; i++)
        {
            //first row
            Table tblTraining = new Table();
            tblTraining.Width = 900;
            TableCell tcLeft1 = new TableCell();
            TableCell tcRight1 = new TableCell();
            TableRow tr1 = new TableRow();
            tr1.CssClass = "cvItemSubHeader";
            Label lblHeader1 = new Label();
            lblHeader1.ID = "Training" + Convert.ToString(i + 1);
            lblHeader1.Text = "Training :" + Convert.ToString(i + 1);
            tcLeft1.CssClass = "cvColumnCaption";
            //tcLeft1.CssClass = "cvItemButtonCell";
            tcLeft1.Controls.Add(lblHeader1);
            tcLeft1.HorizontalAlign = HorizontalAlign.Left;
            Button btnTrainingEdit = new Button();
            btnTrainingEdit.ID = "btnTrainingEdit" + Convert.ToString(i + 1);
            btnTrainingEdit.Text = "Edit";
            btnTrainingEdit.CssClass = "DSEButton4";

            //Label lblHeader2 = new Label();
            //lblHeader2.ID = "LevelofEducationData" + Convert.ToString(i);
            //lblHeader2.Text = dtTraining.Rows[i]["EDUCATIONLEVELNAME"].ToString();
            tcRight1.HorizontalAlign = HorizontalAlign.Right;
            //tcRight1.Style["Padding-left"] ="50";
            tcRight1.CssClass = "cvItemButtonCell";
            tcRight1.Controls.Add(btnTrainingEdit);




            tr1.Cells.Add(tcLeft1);
            tr1.Cells.Add(tcRight1);
            tblTraining.Rows.Add(tr1);


            btnTrainingEdit.Click += new System.EventHandler(btnTrainingEdit_click);
            tcRight1.Controls.Add(btnTrainingEdit);
            tr1.Cells.Add(tcLeft1);
            tr1.Cells.Add(tcRight1);
            tblTraining.Rows.Add(tr1);

            //hidden row for educationid

            tcLeft1 = new TableCell();
            tcRight1 = new TableCell();
            tr1 = new TableRow();

            tr1.CssClass = "hiddenDynamicRows";

            lblHeader1 = new Label();
            lblHeader1.ID = "TRAININGID" + Convert.ToString(i + 1);
            lblHeader1.Text = "TRAININGID";

            tcLeft1.CssClass = "cvColumnCaption";
            tcLeft1.Controls.Add(lblHeader1);
            tcLeft1.HorizontalAlign = HorizontalAlign.Left;


            Label lblHeader2 = new Label();
            lblHeader2.ID = "TRAININGIDData" + Convert.ToString(i + 1);
            lblHeader2.Text = dtTraining.Rows[i]["TRAININGID"].ToString();

            tcRight1.Controls.Add(lblHeader2);


            tr1.Cells.Add(tcLeft1);
            tr1.Cells.Add(tcRight1);
            tblTraining.Rows.Add(tr1);
            Trainings.Controls.Add(tblTraining);
        }
        count = trainingInfoes.Tables[0].Rows.Count;
    }

培训总结

对不起,我的问题不清楚。b保存保存方法将数据保存到数据库中。在将数据保存到数据库后,我需要使用id='Trainings'更新div。我在btainingsave\u Click方法的末尾调用了page\u load方法。但它不起作用。有人能帮我吗?我怎么做?也许这次我的问题很清楚。

这个概念是错误的,刷新页面重定向到同一个URL

<table class="contentRow"  width="900px">
                         <tr     class="cvItemHeader" align="left">
                           <td align="left" >
                                 <div><div    class="cvItemHeaderText"> Training Summary </div>
                               <div class="cvItemHeaderButton">
                                                                     <asp:Button ID="btnAddTraining" runat="server" CssClass="DSEButton4" 
                                                                         Text="Add" onclick="btnAddTrainingInfo_Click" /> </div>                     
                                   </div>
                             </td>

                    </tr>

           <div id="Trainings" runat="server"></div>

                                                </table>

我的问题不对。请你现在看看,这个概念还是错的。如果有几行代码要在页面加载和其他任何地方调用,则可以使用这些代码行创建一个函数,并在任何地方调用它们。单击btnTrainingSave按钮后,我需要调用PopulateRainingInfo来更新div id Trainings。我尝试在btnTrainingSave_Click方法的末尾调用populaterininginfo,但它也不会更新div id。我如何更新div id培训。您的代码中是否有任何UpdatePanel?是的,我提到的aspx代码在UpdatePanel中。
Page.Response.Redirect(Page.Request.Url.ToString(), true);