Click here to Skip to main content
15,885,546 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
See more:
C#
{
        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;
                    }

                }
            }



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


XML
<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>
Posted
Updated 16-Apr-15 19:48pm
v3
Comments
Herman<T>.Instance 16-Apr-15 10:48am    
What's the question?
Not clear.
Praveen Kumar Upadhyay 17-Apr-15 2:32am    
Use Ajax and you can avoid postback.
Sinisa Hajnal 17-Apr-15 2:41am    
Ajax still makes server trip it just hides it by not reloading the whole page.
Sinisa Hajnal 17-Apr-15 2:41am    
What is wrong with postback? Especially if you're using DataGridView...you could lower the impact of the postback by using asp:UpdatePanel

1 solution

Add on blur event on your cell.
In that event (i.e. onBlur), make an ajax call to update the data instead of doing Post back.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900