Congratulations - C# Corner Q4, 2022 MVPs Announced
Why Join
Become a member
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
C# Corner Home
Technologies
Monthly Leaders
ASK A QUESTION
Forum guidelines
Paul Rajs
1.4k
641
113.1k
how to open a Pdf by Clicking gridview Itemtemplate Linkbut
Mar 29 2018 3:14 AM
hi developers ,
i want to open a popup instead of another popup.
when i click the first popup the gridview is opened. inside gridview ther is some Itemtemplate Links for each Chapter. like Chapter1,Chapter2,Chapter3,Chapter4 etc.
when i clicking the Particular Chapter link means the particular chapter pdf file should be open without Refresh the page.
the following code am adding , it is exactly working for Text Only.but i dont know how to open a Pdf instead of this text . thats all.
so please help me how can i open the pdf instead of text on the same way .
so please anyone know how to dispaly a pdf when click gridview itemtemplate suggest me to i am done this task
Html Grid View Code
<
asp:GridView
ID
=
"GridView1"
HeaderStyle-BackColor
=
"#3AC0F2"
HeaderStyle-ForeColor
=
"White"
runat
=
"server"
AutoGenerateColumns
=
"false"
>
<
Columns
>
<
asp:BoundField
DataField
=
"Id"
ItemStyle-CssClass
=
"Id"
HeaderText
=
"Id"
ItemStyle-Width
=
"30"
/>
<
asp:BoundField
DataField
=
"Name"
ItemStyle-CssClass
=
"Name"
HeaderText
=
"Name"
ItemStyle-Width
=
"150"
/>
<
asp:BoundField
DataField
=
"Description"
ItemStyle-CssClass
=
"Description"
HeaderText
=
"Description"
ItemStyle-Width
=
"150"
/>
<
asp:TemplateField
>
<
ItemTemplate
>
<
asp:LinkButton
Text
=
"View"
ID
=
"lnkView"
runat
=
"server"
/>
</
ItemTemplate
>
</
asp:TemplateField
>
</
Columns
>
</
asp:GridView
>
<
div
id
=
"dialog"
style
=
"display: none"
>
<
b
>
Id:
</
b
>
<
span
id
=
"id"
>
</
span
>
<
br
/>
<
b
>
Name:
</
b
>
<
span
id
=
"name"
>
</
span
>
<
br
/>
<
b
>
Description:
</
b
>
<
span
id
=
"description"
>
</
span
>
</
div
>
Jquery Code--
<script type=
"text/javascript"
src=
"http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"
></script>
<script src=
"http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js"
type=
"text/javascript"
></script>
<link href=
"http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
rel=
"stylesheet"
type=
"text/css"
/>
<script type=
"text/javascript"
>
$(document).on(
"click"
,
"[id*=lnkView]"
,
function
()
{
$(
"#id"
).html($(
".Id"
, $(
this
).closest(
"tr"
)).html());
$(
"#name"
).html($(
".Name"
, $(
this
).closest(
"tr"
)).html());
$(
"#description"
).html($(
".Description"
, $(
this
).closest(
"tr"
)).html());
$(
"#dialog"
).dialog({ title:
"View Details"
, buttons: { Ok:
function
() { $(
this
).dialog(
'close'
); } }, modal:
true
});
return
false
; });
</script>
thanking you
Paul.S
Reply
Answers (
1
)
Middleware should ignore specific routes in .net core
Convert .aspx to .html in asp.net c#