Tag Archives: asp.net

Hiding UpdatePanel during UpdateProgress

This was a very simple requirement to hide the currently updating controls. I first ran to the the forums and came across this. The trick was quite simple. When we depend control inside the updatePanel this technique fails. The idea is to wrap the update panel inside say another container like a div and set the control ID to that. The below script triggers the hiding of the control and kicks off the UpdateProgress.

    <script type=”text/xml-script”>

        <page xmlns:script=“http://schemas.microsoft.com/xml-script/2005″>

            <components>

                <control id=GridContent visibilityMode=“Collapse”>

                    <bindings>

                        <binding dataContext=“_PageRequestManager” dataPath=“inPostBack” property=“visible” transform=“Invert” />

                    </bindings>

                </control>

            </components>

        </page>

    </script>

[Atlas] rules :)

For those of you guys who arent convinced yet, I have attached a hello world version to this.

Scroll Position in datagrid within a Div

 

In the ItemDataBound event of your grid add the following code to add
a number bookmark to each row in the grid that is created:
//************ItemDataBound**************************
// placing a bookmark against the first column
LiteralControl anchor = new LiteralControl();
anchor.Text = “<a name=”” + itemCount.ToString() + “”>”;
itemCount ++;
e.Item.Cells[0].Controls.Add(anchor);
//************ItemDataBound**************************

Then in the EditCommand event method add the following code to get the
browser to jump to the item when the page reloads:
//*************EditCommand **************************
System.Text.StringBuilder jScript = new System.Text.StringBuilder();
jScript.Append(“<script language=”JavaScript”>”);
jScript.Append(“location.href=”#”);
jScript.Append(e.Item.ItemIndex.ToString());
jScript.Append(“”;”);
jScript.Append(“</script>”);

this.RegisterClientScriptBlock(“Bookmark”, jScript.ToString());
//************EditCommand *************************

Im not sure about smart navigation enabled with this

 

 

ASP.NET Home: ASP.NET Whidbey: ASP.NET 2.0 Internals

 

Here’s a great article you might be interested in:

ASP.NET Home: ASP.NET 2.0 (codenamed ASP.NET Whidbey) is the next version of
ASP.NET. See all ASP.NET 2.0 content here.While 100 percent backward
compatible with ASP.NET 1.1, ASP.NET 2.0 brings a number of internal changes
to ASP.NET. These include changes to the code model, compilation, page
lifecycle, and more. This article outlines those changes.
URL:http://msdn.microsoft.com/asp.net/whidbey/default.aspx?pull=/library/en-us/dnvs05/html/Internals.asp#internals_topic9?_r=1

ShowModalDialog

I was new to the showModalDialog Script on IE. Then I came across a problem with new browser windows being brought up with server content in the dialog This is the solution i came across


ShowModalDialog

I noticed that the following is an issue thru which people often run: when you show an aspx page (or any server content in general) in a dialog by mean of the JavaScript ShowModalDialog method, at the first postback you usually witness the instance of a second window, his time a full blown browser, holding in your output.

There is an easy workaround to the situation, but surprisingly it seems that few people knows it: so I’m posting it.

The trick is showing a static page , a simple .HTML, in the ShowModalDialog call; such page should hold the active content (your .aspx) in an IFRAME. Subsequent posts will be confined inside the iframe, hence restoring the intended user experience.

UPDATE

J proposes a more efficient system: <base target=”_self”>  in the header of the aspx page yields to the same result. Thank you J :-)

Using the Context.Item Collection

If you try to acces the session object you get an exception at the Application_BeginRequest(…)

You can, however, use Context.Items during Application_BeginRequest. This is an ideal spot to load request specific state to carry through until ASP.NET completes the request. You could, for instance, inspect the incoming request URL and load a preferences object with different settings if the site is balitmore.odetocode.com versus www.odetocode.com. Later, during the Load event of any page, you can inspect the Preferences object in the Items collection to make changes to the UI

protected void Application_BeginRequest(Object sender, EventArgs e) {         string prefix = Request.Url.Host.ToUpper();        if(prefix.StartsWith("BALTIMORE"))         {             Context.Items["PREFERENCES"] = // Load Baltimore preferences         }      else         {             Context.Items["PREFERENCES"] = // Load default preferences         } }

http://odetocode.com/Articles/111.aspx