By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,190 Members | 769 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,190 IT Pros & Developers. It's quick & easy.

C# Web-App: Persisting Title of Modal Dialogbox during Postback

P: 3
Hi All,

I am using ASP.NET 2.0 and C#.

I am opening a Modal Dialog Box from .aspx page.

This dialgo box contains a grid and user can add new recod to this grid from here.

When this dialgo is opend fist time everything works well.

If I add new record on this dialog box which postbacks the page which is contained within the dialog I lost the "Title" of the popup dialog.

I tried to set the "title" on .asp page/Page_Load event but unable to presist the Title of Modaldailog box on Postback.

Regards,
Virendra Jhala
Dec 3 '07 #1
Share this Question
Share on Google+
4 Replies


Frinavale
Expert Mod 5K+
P: 9,731
Hi All,

I am using ASP.NET 2.0 and C#.

I am opening a Modal Dialog Box from .aspx page.

This dialgo box contains a grid and user can add new recod to this grid from here.

When this dialgo is opend fist time everything works well.

If I add new record on this dialog box which postbacks the page which is contained within the dialog I lost the "Title" of the popup dialog.

I tried to set the "title" on .asp page/Page_Load event but unable to presist the Title of Modaldailog box on Postback.

Regards,
Virendra Jhala
Hi Virendra,


You can set the page's title in the <%@ Page ..%> directive...
Eg:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeBehind="Index.aspx.vb" Inherits="MyNamespace.Welcome" title="My Title" %>

Have you tried using globalization to set your title's and prompts?
For instance the following will go to the resource file (.resx file) for this page and automatically set the title...
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeBehind="Index.aspx.vb" Inherits="MyNamespace.Welcome" title="My Title" Culture="auto" meta:resourcekey="PageTitle" UICulture="auto"  %>
This will also grab the culture specific title for the page...eg...if someone were coming to your website and their browser's culture was set to "es-mx", your website will automatically look for a Spanish (Mexico) resource and fill the page's title with this text.

If this isn't the type of answer you're looking for let me know....

-Frinny
Dec 3 '07 #2

P: 3
Hi Frinny,

After posting this issue I did try the first option of setting up the Title in @Page directive but it did not work.

I am using IE 6.0 on Windows XP.

The application does not have anything on Globalization front so I did not attempt your second option.

It seems that there is something inherent in web dialog which is causing this behaviour.

Let me know in case you have anything else.

Here is the sample code I am using for opening the popup on a Html button click.

window.showModalDialog("comment.aspx",'','resizabl e:no;
status:no;dialogWidth:420px;dialogHeight:320px;');


I tried setting up the "Title" in following ways:

1. Passed the argument in the showModalDialog function
2. On the .aspx page <Head><Title></Title></Head>
3. In code behind..Page_Load..this.Title = "Mytitle"
4. In the Page directive

Regards,
Virendra Jhala


Hi Virendra,


You can set the page's title in the <%@ Page ..%> directive...
Eg:

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeBehind="Index.aspx.vb" Inherits="MyNamespace.Welcome" title="My Title" %>

Have you tried using globalization to set your title's and prompts?
For instance the following will go to the resource file (.resx file) for this page and automatically set the title...
Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="vb" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeBehind="Index.aspx.vb" Inherits="MyNamespace.Welcome" title="My Title" Culture="auto" meta:resourcekey="PageTitle" UICulture="auto"  %>
This will also grab the culture specific title for the page...eg...if someone were coming to your website and their browser's culture was set to "es-mx", your website will automatically look for a Spanish (Mexico) resource and fill the page's title with this text.

If this isn't the type of answer you're looking for let me know....

-Frinny
Dec 3 '07 #3

Frinavale
Expert Mod 5K+
P: 9,731
Hi Frinny,

After posting this issue I did try the first option of setting up the Title in @Page directive but it did not work.

I am using IE 6.0 on Windows XP.

The application does not have anything on Globalization front so I did not attempt your second option.

It seems that there is something inherent in web dialog which is causing this behaviour.

Let me know in case you have anything else.

Here is the sample code I am using for opening the popup on a Html button click.

window.showModalDialog("comment.aspx",'','resizabl e:no;
status:no;dialogWidth:420px;dialogHeight:320px;');


I tried setting up the "Title" in following ways:

1. Passed the argument in the showModalDialog function
2. On the .aspx page <Head><Title></Title></Head>
3. In code behind..Page_Load..this.Title = "Mytitle"
4. In the Page directive

Regards,
Virendra Jhala
Could you please post your <%@ Page %> directive.
When I tried:
Expand|Select|Wrap|Line Numbers
  1.  window.showModalDialog("Index.aspx", "", 
  2.       "resizable:no;status:no;dialogWidth:420px;dialogHeight:320px")
It worked fine....

-Frinny
Dec 3 '07 #4

P: 3
Could you please post your <%@ Page %> directive.
When I tried:
Expand|Select|Wrap|Line Numbers
  1.  window.showModalDialog("Index.aspx", "", 
  2.       "resizable:no;status:no;dialogWidth:420px;dialogHeight:320px")
It worked fine....

-Frinny
Hi Frinny,

Here is the page directive of my page.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="OpsComments.aspx.cs"
Inherits="MyCompay.Web.UI.OpsComments" title="My Page" %>

I can see the Title once the modal is opened first time from detail page.

Now I can add new record in this modal by entering some values and hitting Submit button which does a postback on the same popup.

After Postaback I can see the newly added record in the List Grid but the modal dialog is unable to presist the Title.

Regards,
Virendra Jhala
Dec 3 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.