• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1703
  • Last Modified:

Problem with Radio button checked changed event asp .net

Hi Experts,

       I'm using radio buttons in modal pop up extender, some times checked changed event not firing. please provide solution.
0
gpinfotech
Asked:
gpinfotech
1 Solution
 
manishkungwaniCommented:
Is the radio button in the ModalPopup or the trigger for the ModalPopup to start???

Also, please give some more details ...
0
 
Kumaraswamy RCommented:
Any control -autopostback set to true and check will be in the page ,
and also try to use AJAX calls
if you need to call server again in the same page
0
 
gpinfotechAuthor Commented:
i have two radio buttons on ajax modal pop up, based on checked radio button some controls are set to visible false, one time its working fine after one post back its not working
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
manishkungwaniCommented:
could you please copy the code HTML as well as C#, to clarify ..
0
 
gpinfotechAuthor Commented:
<%@ Page Language="C#" AutoEventWireup="true" Codebehind="Pal_ManagerApproval.aspx.cs"
    Inherits="PresentationLayer.Transactions.Pal_ManagerApproval" %>

<%@ Register Src="../Footer.ascx" TagName="Footer" TagPrefix="uc1" %>
<%@ Register Src="../Header.ascx" TagName="Header" TagPrefix="uc2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type="text/javascript" language="javascript">

function fnClickUpdate(sender,e){
__doPostBack(sender,e)}
    </script>

    <link href="../Css/style.css" rel="stylesheet" type="text/css" />
    <link href="../zpwin/themes/dialog.css" rel="stylesheet" type="text/css" />
    <link href="../Css/style.css" rel="stylesheet" type="text/css" />
    <link href="../zpwin/themes/dialog.css" rel="stylesheet" type="text/css" />
</head>
<body onunload="doUnload();">
    <form id="managerapproval" runat="server" defaultbutton="btn_Submit">
        <asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="36000">
        </asp:ScriptManager>
        <div id="table">
            <uc2:Header ID="Header1" runat="server" />
            <div id="totalbody">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:HiddenField ID="hid_Userid" runat="server" Value="" />
                        <asp:HiddenField ID="hid_Startdate" runat="server" Value="" />
                        <asp:HiddenField ID="hid_Enddate" runat="server" Value="" />
                        <asp:HiddenField ID="hid_Leavetypeid" runat="server" Value="" />
                        <asp:HiddenField ID="hid_standbyid" runat="server" Value="" />
                        <asp:HiddenField ID="hid_Useremailid" runat="server" Value="" />
                        <asp:HiddenField ID="hid_applieduserid" runat="server" Value="" />
                        <!-- panel begining-- ------- -->
                        <asp:Panel ID="Panel1" runat="server" CssClass="modalPopup" DefaultButton="btn_Submit"
                            Style="position:relative;">
                            <%--<div style="text-align: right;">
                                <asp:LinkButton ID="lnkbtn_Close" runat="server" Enabled="true" Text="" OnClick="lnkbtn_Close_Click"><img src="../Images/Close.gif"  alt="click to close the window" height="16px" width="16px" style="border:0px;" /></asp:LinkButton>
                            </div>
                            <h4>
                                <u>Approve/Reject Leave&nbsp;:</u></h4>--%>
                            <!-- ----------------- -->
                            <div class="formshape_01">
                            <div class="login_text01">Approve/Reject Leave&nbsp;:</div>
                            <div class="login_style" id="login_text02">
                                <asp:LinkButton ID="lnkbtn_Close" runat="server"  Enabled="true" 
                                                Text="" OnClick="lnkbtn_Close_Click" >
                                 <img src="../Images/Close.gif" style="margin:5px 0 0 0;border:0;" alt="Click here to close the Window" height="16px" width="16px"/></asp:LinkButton>
                            </div>
                            
                            </div>
                            
                            <div class="row">
                                <span class="label">
                                    <label>
                                        User Name&nbsp;:</label>
                                </span>&nbsp;&nbsp;<asp:Label ID="lbl_Username" CssClass="txtcss"  runat="server"></asp:Label>
                            </div>
                            <!-- ------------- -->
                            <div class="row">
                                <span class="label">
                                    <label>
                                        Leave Type&nbsp;:</label>
                                </span>&nbsp;&nbsp;<asp:Label ID="lbl_Leavetype" CssClass="txtcss" runat="server"></asp:Label>
                            </div>
                            <!-- ------------------ -->
                            <div class="row">
                                <span class="label">
                                    <label>
                                        Start Date&nbsp;:</label>
                                </span>&nbsp;&nbsp;
                                <asp:TextBox ID="txt_Startdate" CssClass="txtcss" runat="server"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender1" runat="server" Enabled="true" Format="dd/MMM/yyyy"
                                    TargetControlID="txt_Startdate" PopupButtonID="imgbtn_Startdate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgbtn_Startdate" runat="server" ImageUrl="~/Images/calendar.GIF" />
                                <%-- <asp:Label ID="lbl_Startdate" CssClass="txtcss"  runat="server"></asp:Label>--%>
                            </div>
                            <!-- --------------------- -->
                            <div class="row">
                                <span class="label">
                                    <label>
                                        End Date&nbsp;:</label>
                                </span>&nbsp;&nbsp;
                                <asp:TextBox ID="txt_Enddate" CssClass="txtcss" runat="server"></asp:TextBox>
                                <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="txt_Enddate"
                                    Enabled="true" Format="dd/MMM/yyyy" PopupButtonID="imgbtn_Enddate">
                                </cc1:CalendarExtender>
                                <asp:ImageButton ID="imgbtn_Enddate" runat="server" ImageUrl="~/Images/calendar.GIF" />
                            </div>
                            <!-- ------------------------ -->
                            <div class="row">
                                <span class="label">
                                    <label>
                                        Stand by&nbsp;:</label>
                                </span>&nbsp;&nbsp;
                                <asp:DropDownList ID="ddl_StandBy" runat="server" CssClass="inputbox"  AutoPostBack="True" OnSelectedIndexChanged="ddl_StandBy_SelectedIndexChanged">
                                </asp:DropDownList></div>
                            <!-- ------------------------- -->
                            <div class="row">
                                <span class="label"></span>
                                <asp:RadioButton ID="rbn_Approve" CssClass="txtcss" TabIndex="1" runat="server" Checked="true" 
                                    GroupName="rb1" Text="Approve" AutoPostBack="True" OnCheckedChanged="rbn_Approve_CheckedChanged"  />
                            </div>
                            <div class="row">
                                <span class="label"></span>
                                <asp:RadioButton ID="rbn_Removie" CssClass="txtcss" runat="server" TabIndex="2" GroupName="rb1"
                                    Text="Reject" AutoPostBack="True" OnCheckedChanged="rbn_Removie_CheckedChanged"  />
                            </div>
                            <!-- -------------------------- -->
                            <div class="row">
                                <span class="label">
                                    <label>
                                       <asp:Label ID="lbl_Comments" runat="server" Text="Comments :"></asp:Label></label></span> &nbsp;&nbsp;<asp:TextBox
                                            ID="txt_Comments" TabIndex="3" MaxLength="150" CssClass="inputbox" runat="server"
                                            TextMode="MultiLine" onkeypress="return keyselectcomments(event, this.value)">
                                        </asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfv_Comments" runat="server" Display="None" ValidationGroup="gr1"
                                    EnableClientScript="true" ErrorMessage="Please write comments" SetFocusOnError="true"
                                    Enabled="true" Text="Please write comments" ControlToValidate="txt_Comments">
                                </asp:RequiredFieldValidator>
                                
                                <cc1:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" BehaviorID="ValidatorCalloutExtender1"   TargetControlID="rfv_Comments">
                                </cc1:ValidatorCalloutExtender>
                                
                            </div>
                            <br />
                            <!-- ------------------------ -->
                            <div id="buttion_search02" class="loginbuttonstyle">
                                <label>
                                    <asp:Button ID="btn_Submit" TabIndex="4" CssClass="login_buttonstyle" runat="server" 
                                        Text="Submit"  OnClick="btn_Submit_Click" ValidationGroup="gr1" />
                                </label>
                            </div>
                            <!-- ------------------------- -->
                        </asp:Panel>
                        <!-- panel ending------- -->
                        <cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="Panel1"
                            TargetControlID="btn_Submit" BackgroundCssClass="progressBackgroundFilter1" DropShadow="false" >
                        </cc1:ModalPopupExtender>
                        <div id="formshape_00">
                            <div class="login_style" id="login_text01">
                               Manager Approvals </div>
                        </div>
                        <b class="rbottom"><b class="r4"></b><b class="r3"></b><b class="r2"></b><b class="r1">
                        </b></b>
                        <div id="noofrecords">
                            <asp:Label ID="lbl_Noofrecords" runat="server" Text="No Of Records"></asp:Label>
                            <asp:DropDownList ID="ddl_Noofrecords" AutoPostBack="true" runat="server" OnSelectedIndexChanged="ddl_NoOfRecords_SelectedIndexChanged">
                            </asp:DropDownList>
                        </div>
                        <div id="gride">
                            <asp:GridView ID="gv_Results" runat="server" AutoGenerateColumns="false" AllowPaging="true"
                                AllowSorting="true" Width="100%" EmptyDataText="No records found" OnPageIndexChanging="gv_Results_PageIndexChanging"
                                OnRowCreated="gv_Results_RowCreated" OnSorting="gv_Results_Sorting" OnRowDataBound="gv_Results_RowDataBound"
                                OnRowCommand="gv_Results_RowCommand">
                                <Columns>
                                    <asp:TemplateField HeaderText="UserName" SortExpression="UserName">
                                        <ItemTemplate>
                                            <%#DataBinder.Eval(Container.DataItem, "UserName")%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Start Date" SortExpression="StartDate">
                                        <ItemTemplate>
                                            <%#DataBinder.Eval(Container.DataItem, "StartDate")%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="End Date" SortExpression="EndDate">
                                        <ItemTemplate>
                                            <%#DataBinder.Eval(Container.DataItem, "EndDate")%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Stand by" SortExpression="Standbyemployee">
                                        <ItemTemplate>
                                            <%#DataBinder.Eval(Container.DataItem, "Standbyemployee")%>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                    <asp:TemplateField HeaderText="Approve/Reject">
                                        <ItemTemplate>
                                        
                                            <% if (Convert.ToString(Session["Read"]) == "Y" && Convert.ToString(Session["Write"]) == "Y" && Convert.ToString(Session["Modify"]) == "Y" && Convert.ToString(Session["Delete"]) == "Y")
                                               { %>
                                            <asp:LinkButton ID="lnkbtn_Approvereject" runat="server" CommandName="Approve" CommandArgument='<%# DataBinder.Eval(Container.DataItem,"LeaveId")%>'>
<img src="../Images/edit.png"  alt="Approve/Reject" border="0"/></asp:LinkButton>
                                            <%} %>
                                            <% else
                                                { %>
                                            <img src="../Images/edit.png" alt="unedit" border="0" />
                                            <%} %>
                                        </ItemTemplate>
                                    </asp:TemplateField>
                                </Columns>
                                <AlternatingRowStyle CssClass="GridViewAltRow" />
                                <HeaderStyle CssClass="GridViewHeader" />
                                <EmptyDataRowStyle CssClass="GridViewEmptyRow" />
                                <RowStyle CssClass="GridViewRow" />
                                <PagerTemplate>
                                    <asp:LinkButton ID="lnkbtn_First" runat="server" CommandName="Page" CssClass="colo"
                                        CommandArgument="First" Text="|<<"><img src="../Images/prew01.gif" width="16" height="16" alt="First" border="0"/>
                                    </asp:LinkButton>&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Previous" runat="server" CommandName="Page" CssClass="adminpagenumber"
                                        CommandArgument="Prev" Text="< Previous"> <img src="../Images/prew02.gif" width="16" height="16" alt="Previous" border="0"/>
                                    </asp:LinkButton>&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Num1" runat="server" CommandName="Page" CssClass="adminpagenumber" />&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Num2" runat="server" CommandName="Page" CssClass="adminpagenumber" />&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Num3" runat="server" CommandName="Page" CssClass="adminpagenumber" />&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Num4" runat="server" CommandName="Page" CssClass="adminpagenumber" />&nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Next" runat="server" CommandName="Page" CssClass="adminpagenumber"
                                        CommandArgument="Next" Text="Next>  ">  <img src="../Images/next01.gif" width="16" height="16" alt="Next" border="0"/>
                                    </asp:LinkButton>
                                    &nbsp&nbsp
                                    <asp:LinkButton ID="lnkbtn_Last" runat="server" CommandName="Page" CssClass="adminpagenumber"
                                        CommandArgument="Last" Text=">>|">  <img src="../Images/next02.gif" width="16" height="16" alt="Last" border="0"/>
                                    </asp:LinkButton>
                                </PagerTemplate>
                            </asp:GridView>
                            <br />
                            <center>
                                <asp:Button ID="btn_Export" runat="server" Text="Export To Excel" CssClass="login_buttonstyle_export"
                                    OnClick="btn_Export_Click" />
                            </center>
                            <br />
                        </div>
                    </ContentTemplate>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="btn_Export" />
                    </Triggers>
                    <Triggers>
                        <asp:PostBackTrigger ControlID="rbn_Approve" />
                    </Triggers>
                    
                    
                </asp:UpdatePanel>
            </div>
        </div>
        <uc1:Footer ID="Footer1" runat="server" />
    </form>

    <script type="text/javascript">
  function keyselectcomments(e,s){
if(e.keyCode==13){
document.getElementById("btn_Submit").click()
return false}
return true}

       
       
       
       
  
            
               
        
            
    

      
    </script>


<script language="javascript" type="text/javascript">
    function ClearUI() {
        $find("ValidatorCalloutExtender1").hide();
        $get("txt_Comments").value = "";
    }
    function IsValid() {
        var textbox = $get("txt_Comments");
        if (textbox.value == "") {
            return false;
        }
        else
            return true;
    }
    function ClosePopup() {
        if (IsValid()) {
            $find('modalwithinput').hide();
            alert("You have given your name");
            ClearUI();
        }
    }
</script>


</body>
</html>

Open in new window

0
 
gpinfotechAuthor Commented:

/*------------------------------------------------------------------------------
'
''PROJECT NAME        :Leave Management System
'AUTHOR               :Srinivasu Dandamudi
'DATA BASE            :LMSDB
'FORM NAME            :Manager approval
'TABLES               :LMS_TranLeaveRequest,LMS_MainLeaveTypeDetails,LMS_NonMainLeaveTypeDetails
'SP's                 :SpLMS_GetEditDetails,SpLMS_Checkuserrole,LMS_TranLeaveRequest,LMS_MainLeaveTypeDetails,LMS_NonMainLeaveTypeDetails
'DESCRIPTION          :manager approval for applied leaves
'DATE                 :10/1/2011
'
'
'MODIFICATION HISTORY  :Model pop up implemented instead of java script pop up window
'
'   AUTHOR      DATE            REASON        
    srinivasu.D  31-01-2011
'--------------------------------------------------------------------------------*/
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Microsoft.VisualBasic;
using System.Text;
using System.IO;
using System.Data.SqlClient;
using DataAcessLayer.Transactions;
using DataAcessLayer;

namespace PresentationLayer.Transactions
{
    public partial class Pal_ManagerApproval : System.Web.UI.Page
    {

        /*--------------Start Variable Declaration--------------*/
        private static DataTable dt1 = new DataTable();
        string s = String.Empty;
        Guid gMessage1 = Guid.NewGuid();
        string statusid = String.Empty;
        string userid = String.Empty;
        string leaveid = String.Empty;
        string strScript = String.Empty;
        string loginuserid = String.Empty;
        string fields = String.Empty;
        string values = String.Empty;
        int count = 0;
        string approvedrejectedby = String.Empty;
        string startdate = String.Empty;
        string enddate = String.Empty;
        string leavetypeid = String.Empty;
        string fieldsinsert = String.Empty;
        string valuesinsert = String.Empty;
        string approvereject = String.Empty;
        string Updatedon = String.Empty;
        string standbyid = String.Empty;
        string adminemail = String.Empty;
        string appliedusername = String.Empty;
        string strScript1 = String.Empty;
        string strmessage = String.Empty;
        string mailcomments = String.Empty;
        string NoOfDaysApproved = String.Empty;
        string mailstring = String.Empty;
        string pagetilte = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["pagetilte"]);
        string message = Convert.ToString(System.Configuration.ConfigurationManager.AppSettings["Messagebox"]);

        /*--------------End of variable declaration-----------*/
        protected void Page_Load(object sender, EventArgs e)
        {
            this.Page.Title = pagetilte;

            btn_Submit.OnClientClick = String.Format("fnClickUpdate('{0}','{1}')", btn_Submit.UniqueID, "");

            lnkbtn_Close.OnClientClick = String.Format("fnClickUpdate('{0}','{1}')", lnkbtn_Close.UniqueID, "");


            if (Session["UserID"] == null)
            {
                Response.Redirect("~/Session.aspx", false);
                Session["Values"] = string.Empty;
                //HttpContext.Current.ApplicationInstance.CompleteRequest();

                return;
            }
            else
            {
                Adminuserid = Convert.ToString(Session["UserID"]);
            }
            if (Page.IsPostBack == false)
            {
                this.Page.Title = pagetilte;



                Session.Contents.Remove("flag");
                txt_Startdate.Attributes.Add("ReadOnly", "readOnly");
                this.btn_Submit.Attributes.Add("onclick", "this.value='Please wait...';this.disabled = true;" + this.GetPostBackEventReference(this.btn_Submit));

                if (Request["Read"] != null)
                {
                    Session["Read"] = Request["Read"];
                    Session["Write"] = Request["Write"];
                    Session["Modify"] = Request["Modify"];
                    Session["Delete"] = Request["Delete"];
                }
                /*----------used to fill the records when first time form load ----------*/
                dropdownpagesize();
                ManagerapprovelGridload2();
            }
        }

        public string Adminuserid
        {
            get { return loginuserid; }
            set { loginuserid = value; }
        }

        private void ManagerapprovelGridload2()
        {
            /*------------object creating for Dal_ManagerApproval---------*/
            Dal_ManagerApproval pDAL = new Dal_ManagerApproval();
            DataTable dTablewaitingformgraprval1 = null;
            statusid = "1";
            //adminuserid = Convert.ToString(Session["UserID"]);

            try
            {
                dTablewaitingformgraprval1 = pDAL.Getwaitingforapprovaldetails(statusid, Adminuserid, "");
                if (dTablewaitingformgraprval1.Rows.Count != 0)
                {
                    btn_Export.Visible = true;
                    Cache["gridload"] = dTablewaitingformgraprval1;
                    gv_Results.Visible = true;
                    gv_Results.PageSize = Convert.ToInt32(ddl_Noofrecords.SelectedValue);
                    gv_Results.DataSource = dTablewaitingformgraprval1;
                    gv_Results.DataBind();
                }
                else
                {
                    lbl_Noofrecords.Visible = false;
                    ddl_Noofrecords.Visible = false;
                    btn_Export.Visible = false;
                    gv_Results.Visible = false;
                    btn_Export.Visible = false;

                    gv_Results.DataSource = dTablewaitingformgraprval1;
                    gv_Results.DataBind();
                    // strScript += "myAlert('Leave Management System', 'No records found.', 'return false;');";
                    // ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);
                    return;
                }
            }
            catch (SqlException SqlExep)
            {
                s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (IOException IOExep)
            {
                s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (Exception Exp)
            {
                s = "General Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + Exp.Message + "</b>";
                Session["Error"] = s;

            }
            finally
            {
                Session["Error"] = s;
                if (Session["Error"].ToString() != "")
                {
                    Response.Redirect("~/Exceptions_Throw.aspx", false);
                }
                pDAL = null;
            }
        }

        /*-------used to fill the page size dropdown------------*/
        private void dropdownpagesize()
        {
            DataSet dspagesize = new DataSet();
            dspagesize.ReadXml(MapPath("~/XMLsources/PageSize1.xml"));
            ddl_Noofrecords.DataSource = dspagesize;
            ddl_Noofrecords.DataValueField = "Size";
            ddl_Noofrecords.DataValueField = "SerialNo";
            ddl_Noofrecords.DataBind();

        }

        /*----------used to load the wating for manager approval records---------------*/
        private void ManagerapprovelGridload()
        {

            /*------------object creating for Dal_ManagerApproval---------*/
            Dal_ManagerApproval pDAL = new Dal_ManagerApproval();
            DataTable dTablewaitingformgraprval = null;
            statusid = "1";
            //adminuserid = Convert.ToString(Session["UserID"]);

            try
            {
                dTablewaitingformgraprval = pDAL.Getwaitingforapprovaldetails(statusid, Adminuserid, "");
                if (dTablewaitingformgraprval.Rows.Count != 0)
                {
                    Cache["gridload"] = dTablewaitingformgraprval;
                    gv_Results.Visible = true;
                    gv_Results.PageSize = Convert.ToInt32(ddl_Noofrecords.SelectedValue);
                    gv_Results.DataSource = dTablewaitingformgraprval;
                    gv_Results.DataBind();
                }
                else
                {
                    lbl_Noofrecords.Visible = false;
                    ddl_Noofrecords.Visible = false;
                    gv_Results.Visible = true;
                    btn_Export.Visible = false;
                    gv_Results.DataSource = dTablewaitingformgraprval;
                    gv_Results.DataBind();
                    //strScript += "myAlert('Leave Management System', 'No records found.', 'return false;');";
                    //ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);

                }
            }
            catch (SqlException SqlExep)
            {
                s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (IOException IOExep)
            {
                s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (Exception Exp)
            {
                s = "General Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + Exp.Message + "</b>";
                Session["Error"] = s;

            }
            finally
            {
                Session["Error"] = s;
                if (Session["Error"].ToString() != "")
                {
                    Response.Redirect("~/Exceptions_Throw.aspx", false);
                }
                pDAL = null;
            }

        }
        /*------------------gridview paging------------------------*/

        /*-----------Used to set pager buttons-----------------------------*/
        protected void SetPagerButtonStates(System.Web.UI.WebControls.GridView gridView, GridViewRow gvPagerRow, Page page)
        {

            int pageIndex = gridView.PageIndex;
            int pageCount = gridView.PageCount;
            LinkButton btnFirst = (LinkButton)gvPagerRow.FindControl("lnkbtn_First");
            LinkButton btnPrevious = (LinkButton)gvPagerRow.FindControl("lnkbtn_Previous");
            LinkButton btnNext = (LinkButton)gvPagerRow.FindControl("lnkbtn_Next");
            LinkButton btnLast = (LinkButton)gvPagerRow.FindControl("lnkbtn_Last");
            btnFirst.Enabled = btnPrevious.Enabled = (pageIndex != 0);
            btnNext.Enabled = btnLast.Enabled = (pageIndex < (pageCount - 1));
            LinkButton lnkbtn;
            int startIndex = (pageIndex / 4) * 4;
            int temp;
            for (int i = 1; i < 5; i++)
            {
                lnkbtn = (LinkButton)gvPagerRow.FindControl("lnkbtn_Num" + i);
                temp = startIndex + i;
                if (temp <= pageCount)
                {

                    lnkbtn.Text = temp.ToString();

                    lnkbtn.CommandArgument = temp.ToString();
                    if (temp == pageIndex + 1)
                        lnkbtn.ForeColor = System.Drawing.Color.Red;
                }
                else
                    lnkbtn.Visible = false;
            }


        }



        protected void ddl_NoOfRecords_SelectedIndexChanged(object sender, EventArgs e)
        {
            gv_Results.Visible = true;

            gv_Results.PageSize = Convert.ToInt32(ddl_Noofrecords.SelectedValue);
            gv_Results.DataSource = (DataTable)Cache["gridload"];
            gv_Results.DataBind();
        }

        protected void gv_Results_PageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            gv_Results.PageIndex = e.NewPageIndex;
            DataTable dTable = (DataTable)Cache["gridload"];
            if (dTable != null)
            {
                DataView dv = new DataView(dTable);
                if ((ViewState["SortExp"] != null) && (ViewState["SortOrder"] != null))
                {
                    dv.Sort = Convert.ToString(ViewState["SortExp"]) + " " + Convert.ToString(ViewState["SortOrder"]);
                    gv_Results.DataSource = dv;
                    gv_Results.DataBind();
                }
                else
                {
                    gv_Results.DataSource = dv;
                    gv_Results.DataBind();
                }
            }
        }

        protected void gv_Results_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Pager)
            {
                SetPagerButtonStates(gv_Results, e.Row, this);
            }
        }




        /*---------------End of paging------------------*/


        /*---------------gridview sorting--------------*/

        public const string ASCENDING = " ASC";
        public const string DESCENDING = " DESC";

        public SortDirection GridViewSortDirection
        {
            get
            {
                if (ViewState["SortDirection"] == null)
                {
                    ViewState["SortDirection"] = SortDirection.Ascending;
                }
                return (SortDirection)ViewState["SortDirection"];
            }
            set
            {
                ViewState["SortDirection"] = value;

            }
        }

        /*---------------Used To Sort Records---------------------------------*/
        protected void gv_Results_Sorting(object sender, GridViewSortEventArgs e)
        {

            string sortExpression = e.SortExpression;
            if (GridViewSortDirection == SortDirection.Ascending)
            {
                GridViewSortDirection = SortDirection.Descending;
                sortOfGridview(sortExpression, DESCENDING);
                ViewState["SortExp"] = sortExpression;
                ViewState["SortOrder"] = "DESC";

            }
            else
            {
                GridViewSortDirection = SortDirection.Ascending;
                sortOfGridview(sortExpression, ASCENDING);
                ViewState["SortExp"] = sortExpression;
                ViewState["SortOrder"] = "DESC";

            }


        }

        private void sortOfGridview(string sortExpression, string direction)
        {
            DataTable dTablesort = null;
            dTablesort = (DataTable)Cache["gridload"];
            DataView dv = new DataView(dTablesort);
            dv.Sort = sortExpression + direction;
            gv_Results.DataSource = dv;
            gv_Results.DataBind();
        }
        /*---------------End of gridview sorting-------*/

        protected void gv_Results_RowDataBound(object sender, GridViewRowEventArgs e)
        {

        }

        protected void gv_Results_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Approve")
            {
                int leaveid = Convert.ToInt32(e.CommandArgument);
                Session["leaveid"] = leaveid;
                Modelpopupextendar(leaveid);
            }
           
        }

        /*--------------used to open the model popup extendar-------------*/

        private void Modelpopupextendar(int leaveid)
        {

            Dal_ManagerApproval pDAL = new Dal_ManagerApproval();
            DataTable dTablewaitingforapproval = null;




            rbn_Approve.Checked = true;
            rfv_Comments.Enabled = false;
            btn_Submit.Attributes.Add("CausesValidation", "false");

            txt_Comments.Visible = false;

            lbl_Comments.Visible = false;

           



            try
            {
                dTablewaitingforapproval = pDAL.Getwaitingforapproval(Convert.ToString(leaveid), Adminuserid, "1");

               
                if (dTablewaitingforapproval.Rows.Count != 0)
                {
                    int _leaveuserid = Convert.ToInt32(dTablewaitingforapproval.Rows[0]["UserId"]);
                    lbl_Username.Text = Convert.ToString(dTablewaitingforapproval.Rows[0]["UserName"]);
                    lbl_Leavetype.Text = Convert.ToString(dTablewaitingforapproval.Rows[0]["LeaveType"]);
                    txt_Startdate.Text = Convert.ToString(dTablewaitingforapproval.Rows[0]["StartDate"]);
                    ddl_StandBy.SelectedValue = Convert.ToString(dTablewaitingforapproval.Rows[0]["Standbyid"]);
                    hid_Startdate.Value = txt_Startdate.Text;
                    /*------------- start converting date format---------*/
                    DateTime dt = Convert.ToDateTime(txt_Startdate.Text);
                    txt_Startdate.Text = dt.ToString("dd/MMM/yyyy");


                    txt_Enddate.Text = Convert.ToString(dTablewaitingforapproval.Rows[0]["EndDate"]);
                    hid_Enddate.Value = txt_Enddate.Text;
                    DateTime dt1 = Convert.ToDateTime(txt_Enddate.Text);
                    txt_Enddate.Text = dt1.ToString("dd/MMM/yyyy");


                    /*---------------end of  converting date format---------*/

                    /*---------------Filling DropDownList StandBy---------*/
                    Dal_ManagerApproval Dal = new Dal_ManagerApproval();
                    Dal_SearchUserDetailsStandBy dal1 = new Dal_SearchUserDetailsStandBy();

                    string fdate = string.Empty;
                    string tdate = string.Empty;
                    DataTable dt_dept = new DataTable();
                    dt_dept = dal1.GetDepartmentId(_leaveuserid);
                    int _deptid = Convert.ToInt32(dt_dept.Rows[0][0]);
                    fdate = Microsoft.VisualBasic.Strings.Format(Convert.ToDateTime(dTablewaitingforapproval.Rows[0]["StartDate"]), "yyyy/MM/dd");
                    tdate = Microsoft.VisualBasic.Strings.Format(Convert.ToDateTime(dTablewaitingforapproval.Rows[0]["EndDate"]), "yyyy/MM/dd");
                    Session["fdate1"] = fdate;
                    Session["tdate1"] = tdate;
                    DataTable dt2 = new DataTable();
                    dt2 = Dal.getdetails(_leaveuserid, _deptid, fdate, tdate);//GridView1.DataSource = dt;
                    //count = dt.Rows.Count;
                    Session["standby"] = "Name";
                    ddl_StandBy.DataSource = dt2;
                    ddl_StandBy.DataTextField = "Name";
                    ddl_StandBy.DataValueField = "Userid";
                    ddl_StandBy.DataBind();
               
                    /*--------------End Filling DropDownList StandBy---------*/
                    userid = Convert.ToString(dTablewaitingforapproval.Rows[0]["UserId"]);
                    Session["applyleaveuserid"] = userid;
                    hid_Startdate.Value = Convert.ToString(dTablewaitingforapproval.Rows[0]["StartDate"]);
                    hid_Enddate.Value = Convert.ToString(dTablewaitingforapproval.Rows[0]["EndDate"]);
                    Session["leavetypeid"] = dTablewaitingforapproval.Rows[0]["LeaveTypeID"];
                    Session["standbyid"] = dTablewaitingforapproval.Rows[0]["Standbyid"];
                    Session["applieduseridmail"] = dTablewaitingforapproval.Rows[0]["UserEmail"];
                    Session["appliedleaveusername"] = dTablewaitingforapproval.Rows[0]["UserName"];
                    rbn_Approve.Checked = true;
                    //ScriptManager1.SetFocus(txt_Comments);
                    ModalPopupExtender1.Show();
                }
            }


            catch (SqlException SqlExep)
            {
                s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (IOException IOExep)
            {
                s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (Exception Exp)
            {
                s = "General Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + Exp.Message + "</b>";
                Session["Error"] = s;

            }
            finally
            {
                Session["Error"] = s;
                if (Session["Error"].ToString() != "")
                {
                    Response.Redirect("~/Exceptions_Throw.aspx", false);
                }
                pDAL = null;
            }

        }



        protected void lnkbtn_Close_Click(object sender, EventArgs e)
        {
            resetall();


        }

        private void resetall()
        {
            rbn_Approve.Checked = false;
            rbn_Removie.Checked = false;
            txt_Comments.Text = "";
            //ModalPopupExtender1.Hide();
            ManagerapprovelGridload();
        }



        protected void btn_Submit_Click(object sender, EventArgs e)
        {/*-------Object Creating for Dal_ManagerApproval---------*/

            string adminUsername = String.Empty;
            lnkbtn_Close.Enabled = false;
            Dal_ManagerApproval pDAL = new Dal_ManagerApproval();
            DataTable dTableadminmail = null;
            DataTable dTableusername = null;
            //adminuserid = Convert.ToString(Session["UserID"]);



            if (rbn_Removie.Checked==true)
            {
                btn_Submit.Attributes.Add("CausesValidation", "true");
                rfv_Comments.Enabled = true;
                rfv_Comments.Validate();
                ModalPopupExtender1.Hide();

            }
            else if (rbn_Approve.Checked == true)
            {
                btn_Submit.Attributes.Add("CausesValidation", "false");
                rfv_Comments.Enabled = false;
            }



            try
            {
                if (rfv_Comments.IsValid == true)
                {
                    dTableusername = pDAL.GetUserName(Adminuserid);
                    if (dTableusername.Rows.Count != 0)
                    {
                        adminUsername = dTableusername.Rows[0]["UserName"].ToString();
                    }
                    /*--------- start converting into date time fortmat---------*/
                    if (txt_Startdate.Text != "" && txt_Enddate.Text != "")
                    {
                        DateTime startDtdateandtime = Convert.ToDateTime(txt_Startdate.Text);
                        DateTime endDtdateandtime = Convert.ToDateTime(txt_Enddate.Text);


                        DateTime hiddenfieldstartdate = Convert.ToDateTime(hid_Startdate.Value);
                        DateTime hiddenfieldenddate = Convert.ToDateTime(hid_Enddate.Value);

                        hid_Startdate.Value = hiddenfieldstartdate.ToString("dd/MMM/yyyy");
                        hid_Enddate.Value = hiddenfieldenddate.ToString("dd/MMM/yyyy");

                        if (startDtdateandtime < hiddenfieldstartdate | endDtdateandtime > hiddenfieldenddate)
                        {
                            strmessage = "Leave approval or reject should be" + "<br/><br/>" + "<font color=red>" + hid_Startdate.Value + "</font>" + Strings.Space(2) + "and" + Strings.Space(2) + "<font color=red>" + hid_Enddate.Value + "</font>" + Strings.Space(2) + "Only.";
                            strScript += "myAlert('" + message + "', '" + strmessage + "', 'return false;');";
                            ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);
                            return;
                        }

                        DateTime dt = DateTime.Parse(txt_Startdate.Text);
                        DateTime dt1 = DateTime.Parse(txt_Enddate.Text);
                        //NoOfDaysApproved = Convert.ToDouble(dt1.Subtract(dt));

                        TimeSpan datediff = dt1.Subtract(dt);

                        NoOfDaysApproved = Convert.ToString(datediff.Days);

                        // NoOfDaysApproved = Convert.ToString(dt1.Subtract(dt));
                        /*---------end of converting into date time fortmat---------*/
                        approvedrejectedby = Adminuserid;
                        leaveid = Convert.ToString(Session["leaveid"]);
                        userid = Convert.ToString(Session["applyleaveuserid"]);
                        leavetypeid = Convert.ToString(Session["leavetypeid"]);
                        startdate = txt_Startdate.Text;
                        enddate = txt_Enddate.Text;
                        Updatedon = DateTime.Now.ToString();
                        mailstring = txt_Comments.Text.Trim() + Strings.Space(3) + "for" + Strings.Space(2) + txt_Startdate.Text + Strings.Space(2) + "to" + Strings.Space(2) + txt_Enddate.Text + ".";
                        standbyid = ddl_StandBy.SelectedValue;
                        fields = "StatusId,NoOfDaysApproved,ApproveRejectCancle,ApproveRejectCancleBy,Comments,UpdatedBy,UpdatedOn";
                        fieldsinsert = "LeaveId,LeaveTypeId,UserId,StatusId,StartDate,EndDate,Comments,StandBy,ApproveRejectCancle,ApproveRejectCancleBy,UpdatedBy,UpdatedOn";
                        mailcomments = "Dear" + Strings.Space(6) + Session["appliedleaveusername"].ToString() + ",<br/><br/><br/>" + Strings.Space(6) + txt_Comments.Text;

                        StringBuilder comments = new StringBuilder();
                        comments.Append("Dear" + Strings.Space(3) + Session["appliedleaveusername"] + ",</br></br>");
                        comments.Append("<p>" + Strings.Space(6) + "Your leave application has been approved" + Strings.Space(2) + mailstring + "</p></br></br>");
                        comments.Append("Regards,<br/>" + adminUsername + ".");

                        dTableadminmail = pDAL.Getdepartmentheadmail("LMS_AdminUserDetails", "UserEmail", "UserID=" + Adminuserid);
                        adminemail = Convert.ToString(dTableadminmail.Rows[0]["UserEmail"]);
                        if (rbn_Approve.Checked == true)
                        {
                            approvereject = "A";
                            statusid = "2";
                            values = string.Format("'{0}','{1}','{2}','{3}','{4}','{5}','{6}'", statusid, datediff, approvereject, approvedrejectedby, txt_Comments.Text, approvedrejectedby, Updatedon);
                            valuesinsert = string.Format("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}'", leaveid, leavetypeid, userid, statusid, startdate, enddate, txt_Comments.Text, standbyid, approvereject, approvedrejectedby, approvedrejectedby, Updatedon);
                            count = pDAL.UpdateInsertstatus(fieldsinsert, valuesinsert, leavetypeid, userid,
                                statusid.ToString(), txt_Comments.Text.Trim(), approvereject, Convert.ToString(Adminuserid), Convert.ToString(Adminuserid), leaveid, NoOfDaysApproved);
                            if (count > 0)
                            {

                                MailHelper.MailHelper mail = new MailHelper.MailHelper();
                                count = mail.SendMail(adminemail, Convert.ToString(Session["applieduseridmail"]), "", "", "leave status", comments.ToString());
                                if (count > 0)
                                {
                                    resetall();
                                    appliedusername = String.Empty;
                                    appliedusername = Convert.ToString(Session["appliedleaveusername"]);
                                    strmessage = "<font color=green>" + appliedusername + "</font>" + Strings.Space(4) + "leave application approved for<br/>" + txt_Startdate.Text + Strings.Space(3) + txt_Enddate.Text;
                                    strScript += "myAlert('" + message + "', '" + strmessage + "', 'return false;');";
                                    ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);
                                    return;

                                }

                            }

                        }
                        else
                        {
                            if (rbn_Removie.Checked == true)
                            {
                                approvereject = "R";
                                statusid = "3";
                                values = string.Format("'{0}','{1}','{2}','{3}','{4}','{5}','{6}'", statusid, datediff, approvereject, approvedrejectedby, txt_Comments.Text, approvedrejectedby, Updatedon);
                                valuesinsert = string.Format("'{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}'", leaveid, leavetypeid, userid, statusid, startdate, enddate, txt_Comments.Text, standbyid, approvereject, approvedrejectedby, approvedrejectedby, Updatedon);
                                count = pDAL.UpdateInsertstatus(fieldsinsert, valuesinsert, leavetypeid, userid, statusid, txt_Comments.Text,
                                    approvereject, Adminuserid, Adminuserid, leaveid, NoOfDaysApproved);
                                if (count > 0)
                                {
                                    MailHelper.MailHelper mail = new MailHelper.MailHelper();
                                    count = mail.SendMail(adminemail, Convert.ToString(Session["applieduseridmail"]), "", "", "leave status", comments.ToString());
                                    if (count > 0)
                                    {

                                        resetall();

                                        strmessage = "<font color=green>" + appliedusername + "</font>" + Strings.Space(4) + "leave application rejected.";

                                        strScript += "myAlert('" + message + "', " + strmessage + ", 'return false;');";
                                        ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);
                                        return;


                                    }
                                }
                            }


                        }
                    }
                    else
                    {
                        ModalPopupExtender1.Show();
                    }
                }

                else
                {
                 
                    ModalPopupExtender1.Show();
                   
                }
            }

            catch (SqlException SqlExep)
            {
                s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (IOException IOExep)
            {
                s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (Exception Exp)
            {
                s = "General Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + Exp.Message + "</b>";
                Session["Error"] = s;

            }
            finally
            {
                Session["Error"] = s;
                if (Session["Error"].ToString() != "")
                {
                    Response.Redirect("~/Exceptions_Throw.aspx", false);
                }
                pDAL = null;
            }
            lnkbtn_Close.Enabled = true;

        }

        protected void btn_Export_Click(object sender, EventArgs e)
        {
            DataTable export = new DataTable();

            DataTable dTablemanagerapproval = null;
            Dal_ManagerApproval pDAL = new Dal_ManagerApproval();

            Export_To_Excel.ExportToExcel obj = new Export_To_Excel.ExportToExcel();

            try
            {



                dTablemanagerapproval = (DataTable)Cache["gridload"];

                if (Session["flag"] == null)
                {
                    dTablemanagerapproval.Columns.Remove("UserId");
                    dTablemanagerapproval.Columns.Remove("LeaveId");
                    dTablemanagerapproval.Columns.Remove("LineManagerId");
                    dTablemanagerapproval.Columns.Remove("LeaveTypeID");
                    Session["flag"] = "true";
                }
            }

            catch (SqlException SqlExep)
            {
                s = "An SQL Server 2005 Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + SqlExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (IOException IOExep)
            {
                s = "An IO Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.StackTrace.ToString() + "<br>" + "<b>" + "Error Description:" + Microsoft.VisualBasic.Strings.Space(5) + IOExep.Message + "</b>";
                Session["Error"] = s;

            }
            catch (Exception Exp)
            {
                s = "General Exception Has Occured At: " + "<br>" + "<b>" + "Method Name & File Path & Line Number:" + "</b>" + Microsoft.VisualBasic.Strings.Space(5) + Exp.Message + "</b>";
                Session["Error"] = s;

            }
            finally
            {
                Session["Error"] = s;
                if (Session["Error"].ToString() != "")
                {
                    Response.Redirect("~/Exceptions_Throw.aspx", false);
                }
                pDAL = null;
            }
            obj.Export(dTablemanagerapproval);
        }

        protected void ddl_StandBy_SelectedIndexChanged(object sender, EventArgs e)
        {

            string _userid = ddl_StandBy.SelectedValue;
            startdate = Microsoft.VisualBasic.Strings.Format(Convert.ToDateTime(txt_Startdate.Text), "MM/dd/yyyy");
            enddate = Microsoft.VisualBasic.Strings.Format(Convert.ToDateTime(txt_Enddate.Text), "MM/dd/yyyy");
            //Dal_ApplyLeave dal2 = new Dal_ApplyLeave();
            Dal_ManagerApproval dal2 = new Dal_ManagerApproval();
            int count = dal2.getleavecount(_userid, startdate, enddate);
           
            if (count > 0)
            {
               
                string strScript = null;
                Guid gMessage1 = Guid.NewGuid();
                strScript += "myAlert('" + message + "', 'Sorry This Person also StandBy Please Select Another Person', 'return false;');";
                ScriptManager.RegisterStartupScript(UpdatePanel1, UpdatePanel1.GetType(), gMessage1.ToString(), strScript, true);
                //Panel1.Visible = true;
                             
            }
            else
            {
                ModalPopupExtender1.Show();
            }
        }

        protected void rbn_Removie_CheckedChanged(object sender, EventArgs e)
        {
            if (rbn_Removie.Checked == true)
            {
                lbl_Comments.Visible = true;
                txt_Comments.Visible = true;
                rfv_Comments.Enabled = true;
                btn_Submit.Attributes.Add("CausesValidation", "true");
                ModalPopupExtender1.Show();
            }
        }

        protected void rbn_Approve_CheckedChanged(object sender, EventArgs e)
        {
            if (rbn_Approve.Checked == true)
            {
                lbl_Comments.Visible = false;
                txt_Comments.Visible = false;
                rfv_Comments.Enabled = false;
                btn_Submit.Attributes.Add("CausesValidation", "false");
                ModalPopupExtender1.Show();
            }
        }

   

   
       

    }
}
0
 
manishkungwaniCommented:
Also, can you please provide the C# or VB code ...

The code is correct, just check whether the Control of execution goes into the .aspx.cs or .aspx.vb file or not. To do this, debug the application!!
0
 
gpinfotechAuthor Commented:
THanks ALot
0
 
manishkungwaniCommented:
pls mark the answer for the correct comment ..thanx
0
 
gpinfotechAuthor Commented:
Hi thank u
0
 
Amandeep Singh BhullarCommented:
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now