0

I have a grid view control with list of rows items. Each rows has a button which would triggers a client side pop up modal form to ask the user to enter some data before continue to execute the server side method. The problem is I cant find a way to continue the postback after the user clicked 'Confirm' button on the modal form. Most importantly, the server side method is reside within a DataGrid OnItemCommand Event. Before the method would be executed, several parameters from the other column in the same row would be collected. Any idea to deal with this ? Appreciate so much for anyone can solve it.

//Page aspx

<head>
<link href="jquery-ui-1.7.2.custom.css" type="text/css" rel="stylesheet"/>
<script src="../../Javascript/jquery-1.4.2.min.js" type="text/javascript">
</script>
<script src="../../Javascript/jquery-ui-1.8.2.custom.min.js" type="text/javascript">
</script>

<script type="text/javascript">

        $(document).ready(function () {

                 $('#dialog').dialog({
                autoOpen: false,
                height: 280,
                modal: true,
                resizable: false,
                open: function(type, data) {$(this).parent().appendTo("form");},
                buttons: {
                    'Cancel': function () {
                        $(this).dialog('close');
                        // Submit Rating
                        return false;
                    },
                    'Confirm': function () {
                        $(this).dialog('close');
                        // Update Rating
                    }
                }
            });

        });

        function employeeNumberModal() {

            $('#dialog').dialog('open');

        }

    </script>

</head>

 <form id="Form1" method="post" runat="server">
 <div>
<asp:Grid ID="grid" runat="server">

<asp:BoundColumn Visible="False" DataField="cand_id" SortExpression="cand_id">
</asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="job_post_id" SortExpression="job_post_id">
</asp:BoundColumn>
<asp:BoundColumn Visible="False" DataField="schd_id" SortExpression="schd_id">
</asp:BoundColumn>

<asp:TemplateColumn>
 <ItemStyle HorizontalAlign="Center"></ItemStyle>
 <ItemTemplate>
 <asp:Button ID="btnSync" runat="server" Text="Sync Employee" OnClientClick="if(!employeeNumberModal()) return false;"
 CommandName="Sync"></asp:Button>
  </ItemTemplate>
 /asp:TemplateColumn>

</asp:SuperGrid>
</div>

<div id="dialog" title="New Employee Number">
<p>Please enter new employee number for the candidate</p>
<p><asp:TextBox ID="txtNewEmpNo" runat="server" Width="80%"></asp:TextBox></p>
</div>

</form>

//code behind

this.grid.ItemCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.grid_ItemCommand);

private void grid_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
    switch (e.CommandName)
    {
        case "Sync":
                    CandidateBusiness candBizObj = new CandidateBusiness();
                    candBizObj.CandidateId = e.Item.Cells[0].Text;
                    candBizObj.JobPostId = e.Item.Cells[1].Text;
                    candBizObj.ScheduleId = e.Item.Cells[2].Text;
                    candBizObj.SyncToEmployee();
                    break;
    }
}
2
Contributors
1
Reply
5
Views
4 Years
Discussion Span
Last Post by annaharris
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.