使用javascript更新每个gridview单元格而不回发

使用javascript更新每个gridview单元格而不回发

本文介绍了使用javascript更新每个gridview单元格而不回发的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

{
        CTBProcessList objSubmitDAL = new CTBProcessList();
        objSubmitDAL.intCompanyCode = Convert.ToInt32(Session["iCompanyCode"]);
        objSubmitDAL.intDTCode = Convert.ToInt32(Session["iDTCode"]);
        objSubmitDAL.intUID = Convert.ToInt32(Session["iUid"]);
        objSubmitDAL.intCECode = 0;
        objSubmitDAL.intCEDCode = 0;
        objSubmitDAL.intCurrencyCode = Convert.ToInt32(Session["intNativeCurrencyCode"]);
        objSubmitDAL.intCurrencyTypeCode = 0;
        objSubmitDAL.strACCcode = EIPAccountingCenter.SelectedValue.ToString();
        objSubmitDAL.dtFinStartDate =Convert.ToDateTime(Session["finstartdate"]);//Convert.ToDateTime(lblSelectedFromDate.Text); 
        objSubmitDAL.dtFinEndDate = Convert.ToDateTime(Session["finenddate"]);//Convert.ToDateTime(lblSelectedToDate.Text);
        objSubmitDAL.dtProcessingDate = Convert.ToDateTime(EIPProcessingDateCal.SelectedDate);
        objSubmitDAL.strDocNumber = null;
        objSubmitDAL.strReferenceNumber = null;
        objSubmitDAL.chrSchedule = 'P';

        int count = grvProcessList.Rows.Count;
        int intFlag = 0;

        foreach (GridViewRow row in grvProcessList.Rows)
        {   
            CheckBox cbSingle = (CheckBox)row.FindControl("ChkSingleSelect");
            Label lblProcessStepID = (Label)row.FindControl("lblPcsID");
            Label lblScheduleID = (Label)row.FindControl("lblScheduleID");
            Label lblProcedureID = (Label)row.FindControl("lblProcedureID");
            Label lblApplicableForPosting = (Label)row.FindControl("lblFlagID");
            Label lblStatus = (Label)row.FindControl("lblStatus");
            Image imgloading = (Image)row.FindControl("imgLoading");          
            Label lblProcedureNameList = (Label)row.FindControl("lblScheduleProedure");

            Label lblCompletedOn = (Label)row.FindControl("lblCompletedOn");
            Label lblProcessedBy = (Label)row.FindControl("lblProcessedBy");

            string strProcedureNameList = lblProcedureNameList.Text.ToString();

            if (cbSingle.Checked == true && cbSingle.Enabled == true && intFlag == 0)
            {
                lblStatus.Text = "In Progress";
                imgloading.Visible = true;
                cbSingle.Enabled = false;
                lblStatus.ForeColor = System.Drawing.Color.Purple;
                intFlag = 1;
             }

            else if (cbSingle.Checked == true && cbSingle.Enabled == true)
            {
                lblStatus.Text = "Requested";                
            }

            if (lblApplicableForPosting.Text == "Y")
            {                    
                if (cbSingle.Checked == true && intFlag == 1)
                {
                    objSubmitDAL.intScheduleID = Convert.ToInt32(lblScheduleID.Text);
                    objSubmitDAL.intStepID = Convert.ToInt32(lblProcessStepID.Text);
                    if (strProcedureNameList.ToString() != "")
                    {
                        objSubmitDAL.dsProcedureName = strProcedureNameList.ToString();
                    }
                    DataSet dsSubmitProcess = new DataSet();
                    string strErrorMessage = "";
                    dsSubmitProcess = objSubmitDAL.ExecuteCTBProcessDetails();

                    IEnumerable<ctbprocesslist> ieSubmitDetails = null;
                    if (dsSubmitProcess.Tables.Count > 1)
                    {
                        ieSubmitDetails = dsSubmitProcess.Tables[1].AsEnumerable().Select(items => new CTBProcessList
                        {
                            strProcessedBy = items.Field<string>("Processed_By"),
                            dtCompletedOn = items.Field<datetime>("RLPS_Process_Completed_On"),
                            strStatusDescription = items.Field<string>("MSS_Description")

                        });

                    }
                    else
                    {
                        ieSubmitDetails = dsSubmitProcess.Tables[0].AsEnumerable().Select(items => new CTBProcessList
                        {
                            strProcessedBy = items.Field<string>("Processed_By"),
                            dtCompletedOn = items.Field<datetime>("RLPS_Process_Completed_On"),
                            strStatusDescription = items.Field<string>("MSS_Description")

                        });
                    }

                    lblCompletedOn.Text = ieSubmitDetails.ToList()[0].dtCompletedOn.ToString();
                    lblProcessedBy.Text = ieSubmitDetails.ToList()[0].strProcessedBy;
                    lblStatus.Text = ieSubmitDetails.ToList()[0].strStatusDescription;

                    imgloading.Visible = false;
                    if (lblStatus.Text.ToString() == "Completed")
                    {
                        cbSingle.Enabled = false;
                        cbSingle.Checked = false;
                        lblStatus.ForeColor = System.Drawing.Color.Blue;
                        intFlag = 0;
                    }
                    else if (lblStatus.Text.ToString() == "Error")
                    {
                        cbSingle.Enabled = true;
                        cbSingle.Checked = false;
                        lblStatus.ForeColor = System.Drawing.Color.Red;
                        intFlag = 0;
                    }
                    else if (lblStatus.Text.ToString() == "In Progress")
                    {
                        cbSingle.Enabled = true;
                        cbSingle.Checked = false;
                        lblStatus.ForeColor = System.Drawing.Color.Purple;
                        //intFlag = 0;
                    }

                }
            }







============ =====================








=================================


<asp:GridView ID="grvProcessList" runat="server" AutoGenerateColumns="false" Width="50%"

                                                               AllowPaging="false" PageSize="10" OnRowDataBound="grvProcessList_RowDataBound">
                                                               <Columns>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Sl. No">
                                                                       <ItemTemplate>
                                                                           <asp:Label ID="lblslno" runat="server" Text='<%#Container.DataItemIndex+1 %>'></asp:Label>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Process">
                                                                       <ItemTemplate>
                                                                           <asp:LinkButton ID="lblProcessName" runat="server" Text='<% #Bind("TSTS_Step_Name")%>'></asp:LinkButton>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Status">
                                                                       <ItemTemplate>
                                                                           <asp:Label ID="lblStatus" runat="server" Text='<% #Bind("MSS_Description")%>'></asp:Label>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Started On">
                                                                       <ItemTemplate>
                                                                           <asp:Label ID="lblStartedOn" runat="server" Text='<% #Bind("RLPS_Process_Triggered_On")%>'></asp:Label>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Processed On">
                                                                       <ItemTemplate>
                                                                           <asp:Label ID="lblcompletedOn" runat="server" Text='<% #Bind("RLPS_Process_Completed_On")%>'></asp:Label>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left">
                                                                       <HeaderTemplate>
                                                                           <asp:CheckBox ID="chkSelectHeader" runat="server" onclick="javascript:checkAll(this);"

                                                                               AutoPostBack="True"

                                                                               OnCheckedChanged="chkSelectHeader_CheckedChanged" />
                                                                       </HeaderTemplate>
                                                                       <ItemTemplate>
                                                                           <asp:CheckBox ID="CheckBox1" onclick="Check_Click(this);" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" />
                                                                          <%-- <asp:CheckBox ID="chkSelect" runat="server" AutoPostBack="true" OnCheckedChanged="chkSelect_CheckedChanged"/>--%>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>
                                                                   <asp:TemplateField ItemStyle-HorizontalAlign="Left" HeaderText="Processed By">
                                                                       <ItemTemplate>
                                                                           <asp:Label ID="lblCompletedBy" runat="server" Text='<% #Bind("strProcessedby")%>'></asp:Label>
                                                                       </ItemTemplate>
                                                                   </asp:TemplateField>



                                                               </Columns>
                                                           </asp:GridView>

推荐答案


这篇关于使用javascript更新每个gridview单元格而不回发的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 06:58