Manoj Maharana

Manoj Maharana

  • NA
  • 362
  • 128.1k

How to open a popup div in Codebehind c#

Feb 10 2017 10:13 AM
Open Popup on Item Template c#. My problem is that when i click the popup it will open the popup but it will not hit the RowCommand argument(i.e. e.commandname). Here is the code:
  1. <ItemTemplate><asp:LinkButton ID="imgAppointment" Text="Appointment" runat="server" Style="float: left; margin-right: 5px;" CommandName="App" CommandArgument='<%#Eval("ID") %>' CssClass="label label-sm label-success" data-backdrop="static" data-toggle="modal" data-target="#AddTask"></asp:LinkButton></ItemTemplate>  
This is the code on :
  1. protected void gvTaskDetails_RowCommand(object sender, GridViewCommandEventArgs e)  
  2.         {  
  3.  if (e.CommandName == "App")  
  4.         {  
  5.             DataTable retval = obj.FetchAppointmentByMalmrktId(Convert.ToInt32(e.CommandArgument));  
  6.             if (retval.Rows.Count > 0)  
  7.             {  
  8.                 Repeater rptCustomers = (Repeater)Page.FindControl("rptCustomers");  
  9.                 rptCustomers.DataSource = retval;  
  10.                 rptCustomers.DataBind();  
  11.   
  12.             }  
  13.         }  
  14.             }  
 This is the popup div:
  1. <div class="modal fade " id="AddTask" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" style="margin-right: -15px !important;">  
  2.    <div class="modal-dialog" style="margin-right: 0; width: 50%; margin-top: 0; margin-bottom: 0px; background: #fff; height: 100vh; overflow-y: auto;">  
  3.        <div class="modal-header">  
  4.            <div class="row">  
  5.                <div class="col-sm-6">  
  6.                    <h3 class="text-primary text-big" style="margin-top: 0px; margin-bottom: 0px;"><b>Appointment </b></h3>  
  7.                </div>  
  8.                <div class="col-sm-6">  
  9.                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-chevron-circle-right" id="btnAddTaskclose"></i></button>  
  10.                </div>  
  11.            </div>  
  12. lt;asp:Repeater ID="rptCustomers" runat="server">  
  13.                        <HeaderTemplate>  
  14.                            <div class="box-model">  
  15.                                <table class="table">  
  16.                                    <tr>  
  17.                                        <th style="width: 140px;">Appointment Date :  
  18.                                        </th>  
  19.                                    </tr>  
  20.                                    <tr>  
  21.                                        <th style="width: 140px;">Details  :  
  22.                                        </th>  
  23.                                    </tr>  
  24.                                </table>  
  25.                            </div>  
  26.                        </HeaderTemplate>  
  27.   
  28.                        <ItemTemplate>  
  29.                            <tr>  
  30.                                <td style="width: 400px;">  
  31.                                    <asp:Label ID="lbAppointmentdt" runat="server" Text='<%# Eval("Appointmentdate") %>' />  
  32.                                </td>  
  33.                                <td style="width: 400px;">  
  34.                                    <asp:Label ID="lblDetails" runat="server" Text='<%# Eval("Details") %>' />  
  35.                                </td>  
  36.                                <td>Status  
  37.                                    <br />  
  38.                                    <button type="button" class="btn btn-xs btn-danger">Cancel Appointment</button>  
  39.                                </td>  
  40.                            </tr>  
  41.                        </ItemTemplate>  
  42.   
  43.   
  44.                    </asp:Repeater>  
I want to bind the repeater on  popup div..but if i  delete data-backdrop="static" data-toggle="modal" data-target="#AddTask" in item template of grid then the e.argument works..but popup is not opening..any suggestion???
 
How to open the popup and bind the repeater using c#?? 
 

Answers (2)