We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,965 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to open pop-up window in asp.net web application?

Hi.,
I'm developing a web application,in this application using a gridview data control and show Employee details like Empid, EmpName, designation like that. i need when i click the "Empid" field, to show popup window and list that Employee all details in child window. how to do this? please Anyone can help me..
5
Contributors
4
Replies
1 Week
Discussion Span
2 Months Ago
Last Updated
23
Views
raajsj
Newbie Poster
8 posts since Feb 2013
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Try having a look at Windows.Forms.MessageBox. I am not sure if that is something you want.

or you could always use the alert function in JavaScript.

rotten69
Master Poster
747 posts since May 2011
Reputation Points: 36
Solved Threads: 47
Skill Endorsements: 11

In your gridview you need to add a control such as a link button. When clicked, it should open a small pop-up page. The link button would pass a parameter to this page such as EmpID. Then, on the pop-up page, add a details view control and additional code to query your data source and retrieve the employee's record and display in the details view.

This is just one approach. There are other ways to accomplish the same goal.

JorgeM
Industrious Poster
4,017 posts since Dec 2011
Reputation Points: 294
Solved Threads: 546
Skill Endorsements: 115

Personally, I would stick with using javascript's alert function since it is dead simple to implement, but it is also a simple display, which it seems you are not really interested in, so you may want to try out some jQuery, I know it seems a little daunting at first but it can easily make some of the most beautiful popups I have ever seen, especially colorbox.

To use javascript, in your code behind page you could do something like this

Dim strScript As String = "<a href='javascript:alert("""Employee ID:" & strEmpID & """);'>" & strEmpName & "</a>"

then write that variable into the grid as a link as text however you can.

Using jQuery you could create an iframe that has some text boxes in it and then create a jQuery function that will call the colorbox to display the iframe, maybe make the link like this....

dim strLinkText as string = "<a href='javascript:ShowEmpInfo(" & Chr(34) & "EmpInfo.aspx?empid=" & strEmpID & Chr(34) & ");'><font color='white' backcolor='#738ca0'>" & strEmpName & "</a>"

and then in jQuery/javascript you have a function called ShowEmpInfo...

function ShowEscore(url) {
   // alert(url); //for testing to make sure it is firing

   //iframe ID of EmpInfo
$('#EmpInfo').show();
    $.fn.colorbox({ 'href': '#EmpInfo', 'open': true, 'inline': true, 'width': '800px', 'height': '550px' });
    $().bind('cbox_closed', function () {

        $('#EmpInfo').hide();
    });
}

Now for jQuery you will need to have 2 files included in the .aspx page one for jQuery and one for colorbox, which you will need to grab from the following sites.
http://jquery.com/
http://www.designresourcebox.com/colorbox-lightbox-plugin/

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script> 

Hope this helps...if you need more info I will try to help,
Larry

hometownnerd
Light Poster
37 posts since Sep 2007
Reputation Points: 21
Solved Threads: 4
Skill Endorsements: 2

try to use AJAX.. and use modalpopupExtender. that's the easiest way..

cyberdaemon
Junior Poster
125 posts since Nov 2010
Reputation Points: 11
Solved Threads: 2
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0761 seconds using 2.7MB