I want to display modal popup on click of link button in grid view. below is the code but not displaying modal but the page refreshes.
------------------------------------------------------------
HTML
------------------------------------------------------------
<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin_Master.Master" AutoEventWireup="true" CodeBehind="Search_Product.aspx.cs" Inherits="WhizCraft.Admin.Seearch_Product" %>
.icon-resize
{
font-size:20px;
color:#d95459;
}
function openModal() {
$('[id*=myModal').modal('show');
}
<%--
Enter Product Name
CssClass="table table-bordered" AutoGenerateColumns="False"
PagerSettings-Mode="Numeric" onrowdeleting="ProductGridView_RowDeleting" >
<%-- --%>
Image
<%--
--%>
C#
-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
namespace WhizCraft.Admin
{
public partial class Seearch_Product : System.Web.UI.Page
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["WhizcraftDBConnect"].ConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadProducts();
}
}
private void LoadProducts()
{
try
{
DataTable dt;
using (SqlCommand cmd = new SqlCommand("GetProducts", con))
{
cmd.CommandType = CommandType.StoredProcedure;
using (SqlDataAdapter ad = new SqlDataAdapter(cmd))
{
dt = new DataTable();
ad.Fill(dt);
}
ProductGridView.DataSource = dt;
ProductGridView.DataBind();
}
}
catch (Exception ex)
{
throw;
}
}
protected void ProductGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LinkButton lnkDelete = (LinkButton)ProductGridView.Rows[e.RowIndex].FindControl("lnkDelete");
using (SqlCommand cmd = new SqlCommand("DELETE FROM tblProduct WHERE PID=@PID", con))
{
cmd.Parameters.AddWithValue("@PID", Convert.ToInt32(lnkDelete.CommandArgument));
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
LoadProducts();
}
protected void ViewImage(object sender, EventArgs e)
{
LinkButton lnkView = sender as LinkButton;
ProductImg.ImageUrl = lnkView.CommandArgument.ToString();
ClientScript.RegisterStartupScript(this.GetType(), "Pop", "openModal();", true);
}
}
}
-------------------------------------------------------------------------------------------------------

Laxmidhar SahooRank #383 · 6.6K reputationPosted Oct 26, 2018, 7:59 PM EDT
Akash Patel116 reputationPosted Oct 26, 2018, 11:56 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Oct 27, 2018, 8:45 PM EDT
Akash Patel116 reputationPosted Oct 28, 2018, 5:39 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Oct 28, 2018, 6:27 PM EDT
Akash Patel116 reputationPosted Oct 28, 2018, 8:48 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Oct 28, 2018, 11:02 PM EDT
Akash Patel116 reputationPosted Oct 28, 2018, 11:23 PM EDT
Laxmidhar SahooRank #383 · 6.6K reputationPosted Oct 29, 2018, 12:01 AM EDT