Use showmodaldialog mode window (record) in Asp.net)

Source: Internet
Author: User

A little broken... Finally, the pattern form is created... to commemorate...

① Place the girdview control on the page to display the information list.

Page:("Reply" in the Operation column is a hyperlink. After clicking it, open the mode window and pass the value in the past)

PageSource code

 

Page source code

  1   <  ASP: gridview  ID  = "Gvnotreturn"  Runat  = "Server" Autogeneratecolumns  = "False"  Allowpaging  = "True"  
2 Backcolor = "White" Bordercolor = "#999999" Borderstyle = "NONE" Borderwidth = "1px"
3 Cellpadding = "3" Gridlines = "Vertical" Onpageindexchanging = "Gvnotreturn_pageindexchanging1"
4 Pagesize = "5" Width = "100%" >
5   < Rowstyle Backcolor = "# Eeeeee" Forecolor = "Black" />
6   < Columns >
7   < ASP: templatefield Headertext = "Select" >
8   < Itemtemplate >
9   < ASP: checkbox ID = "Cbno" Runat = "Server" />
10   </ Itemtemplate >
11   < Itemstyle Width = "30px" />
12   </ ASP: templatefield >
13   < ASP: templatefield Headertext = "No" >
14 < Itemtemplate >
15 < ASP: Label ID = "Lblid" Runat = "Server" Text = '<% # Eval ("gid") % > '> </ ASP: Label >
16 </ Itemtemplate >
17 < Itemstyle Width = "40px" Horizontalalign = "Center" />
18 </ ASP: templatefield >
19 < ASP: templatefield Headertext = "Title" >
20 < Itemtemplate >
21 < ASP: Label ID = "Label1" Runat = "Server" Text = '<% # Eval ("gtitle") % > '> </ ASP: Label >
22 </ Itemtemplate >
23 </ ASP: templatefield >
24 < ASP: templatefield Headertext = "Message date" >
25 < Itemtemplate >
26 < ASP: Label ID = "Label2" Runat = "Server" Text = '<% # Eval ("gpubdate") % > '> </ ASP: Label >
27 </ Itemtemplate >
28 < Itemstyle Width = "120px" Horizontalalign = "Center" />
29 </ ASP: templatefield >
30 < ASP: templatefield Headertext = "Operation" >
31 < Itemtemplate >
32 < A Href = "Javascript: showmodaldialog ('ansmsg. aspx? Id = <% # eval (" Gid ") % > '); Window. Location. Reload () ">
33 Reply </ A >
34 </ Itemtemplate >
35 < Itemstyle Width = "50px" Horizontalalign = "Center" />
36 </ ASP: templatefield >
37 </ Columns >
38 < Footerstyle Backcolor = "# Cccccc" Forecolor = "Black" />
39 < Pagerstyle Backcolor = "#999999" Forecolor = "Black" Horizontalalign = "Center" />
40 < Selectedrowstyle Backcolor = "# 008a8c" Font-bold = "True" Forecolor = "White" />
41 < Headerstyle Backcolor = "#000084" Font-bold = "True" Forecolor = "White" />
42 < Alternatingrowstyle Backcolor = "# Dcdcdc" />
43 </ ASP: gridview >

 

 

SourceCodeExplanation:

 

  <AHref= "Javascript: showmodaldialog ('ansmsg. aspx? Id = <% # eval ("Gid ") %>'); Window. Location. Reload () ">
Reply</A>

 

 

A common page points to the link... passing the parameter ID in the past... and then adds window. Location. Reload ()

This window. Location. Reload () indicates that the parent page is refreshed after the mode form is closed.

 

Ansmsg. aspx is the mode form to be popped up ..

Add the following code on the ansmsg. ASPX page:

 

 

 
   Protected VoidPage_load (ObjectSender, eventargs E)
{
Response. Expires= 0;}

This indicates that the mode form page cache is disabled ..

If this is not done, the address bar ID will not change. The content will not change ..

For example, my function is as follows ..:

In this case .. if you do not add a forbidden page cache .. I need to reply message board information .. repeat the mode form opened by the "reply" link .. the content will not change .. even if the database has been updated...

 

 

If this page is closely displaying information, but there is no submit button... I want to do this already OK...

However, this mode form has a submit button, which means that I need to send data back ..

At this time, a problem occurs ....

After you click the submit button, the format will be displayed on the new page...

The meaning of the mode form is lost...

This is not very good... but how can we solve it?

The method is very simple ..

Add the following code to the source code of the page that appears as the mode form ..

 

  </Head>
<BaseTarget= "_ Self" />
<Body>

Here... everything is OK/... success... thank you for visiting...

 

 

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.