You must Sign In to post a response.
  • Category: ASP.NET

    Why not bootstrap modal opening in asp.net

    hi,

    <script type="text/javascript">
    $('#currentdetail').modal('show');
    </script>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <div>
    <asp:DataGrid ID="dgCurrent" runat="server" Width="940px" HorizontalAlign="Center"
    OnRowCommand="dgCurrent_ItemCommand" AutoGenerateColumns="false" AllowPaging="false"
    CssClass="table table-hover table-striped">
    <Columns>
    <asp:ButtonColumn CommandName="detail" Text="Detail"></asp:ButtonColumn>
    <asp:BoundColumn DataField="ID" HeaderText="Code" />
    <asp:BoundColumn DataField="FarmerName" HeaderText="Name" />
    <asp:BoundColumn DataField="ContactNo" HeaderText="Continent" />
    <asp:BoundColumn DataField="EmailID" HeaderText="Surface Area" />
    </Columns>
    </asp:DataGrid>
    </div>
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server">
    <ProgressTemplate>
    <img src="" alt="Loading.. Please wait!" />
    </ProgressTemplate>
    </asp:UpdateProgress>
    <div id="currentdetail" class="modal hide fade">
    <div class="modal-header">
    <asp:Button ID="bclose1" runat="server" class="close" Text="x" />
    <h3 id="myModalLabel">
    Detailed View</h3>
    </div>
    <div class="modal-body">
    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
    <ContentTemplate>
    <asp:DetailsView ID="DetailsView1" runat="server" CssClass="table table-bordered table-hover"
    BackColor="White" ForeColor="Black" BorderStyle="Groove" AutoGenerateRows="False">
    <Fields>
    <asp:BoundField DataField="ID" HeaderText="Code" />
    <asp:BoundField DataField="FarmerName" HeaderText="Name" />
    <asp:BoundField DataField="ContactNo" HeaderText="Continent" />
    <asp:BoundField DataField="EmailID" HeaderText="Surface Area" />
    </Fields>
    </asp:DetailsView>
    </ContentTemplate>
    <Triggers>
    <asp:AsyncPostBackTrigger ControlID="dgCurrent" EventName="ItemCommand" />
    </Triggers>
    </asp:UpdatePanel>
    <div class="modal-footer">
    <asp:Button ID="bClose" class="btn btn-info" Text="Close" runat="server" />
    </div>
    </div>
    </div>

    cs.Code :
    protected void dgCurrent_ItemCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    DataTable sourceData;

    try
    {
    {
    GetFarmerStatusData();
    sourceData = new DataTable();
    sourceData = (DataTable)this.dgCurrent.DataSource;

    int index = Convert.ToInt32(e.CommandArgument);
    //string code = dgCurrent.DataKeys[index].ToString();
    //IEnumerable<DataRow> query = from i in sourceData.AsEnumerable()
    // where i.Field<String>("ID").Equals(Convert.ToString(code))
    // select i;



    DataTable detailTable = sourceData;

    detailTable.DefaultView.RowFilter = "ID = " + 1;
    detailTable = detailTable.DefaultView.ToTable();

    DetailsView1.DataSource = detailTable;
    DetailsView1.DataBind();
    System.Text.StringBuilder sb = new System.Text.StringBuilder();
    sb.Append(@"<script type='text/javascript'>");
    sb.Append("$('#currentdetail').modal('show');");
    sb.Append(@"</script>");
    ScriptManager.RegisterClientScriptBlock(this, this.GetType(),
    "ModalScript", sb.ToString(), false);
    }
    }
    catch (Exception ex)
    {
    throw ex;
    }
    }
  • #766526
    Hi
    you need refer the jquery and bootstrap script in your aspx page in client side

    Refer this urls


    "aspforums.net/Threads/135882/Solved-Bootstrap-Modal-Dialog-Popup-example-in-ASPNet/"
    "c-sharpcorner.com/UploadFile/47548d/twitter-bootstrap-modal-popup-dialog/"

    Name : Dotnet Developer-2015
    Email Id :kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


Sign In to post your comments