Labels

Thursday, March 29, 2007

Hide Error Label on Anchor Click.

Below Sequence fires.

  • When link is clicked it hides the label by calling 'onClick="Hide()' hides the label.
  • When the button is clicked below event happens:
    • button_clientside_click : NA
    • Page_Load: Label gets Visible due to declarative values.
    • Button_ServerSide_Click :
    • Page_PreRender
    • body_onload_clientside : NA
    • Page_Render : Label gets Visible
    • Page_Unload

Hence when the button is clicked you will see the label again. i.e Server does not consider the changes made by client.

// -----------------------------------------------
function Hide()
{
document.getElementById('Label1').style.display='none';
}
// -----------------------------------------------


Hope it is Clear now.


Hide Error Label on Body On-Load.

Below sequence fires.

  • At first time 'onload="Hide()' hides the label.
  • When the button is clicked below event happens:
    • button_clientside_click :
    • Page_Load: Label gets Visible here using the declarative values.
    • Button_ServerSide_Click : Sleeps thread for 2 secs.
    • Page_PreRender
    • body_onload_clientside : This hides Label again by calling 'onload="Hide();'
    • Page_Render : Label gets In-Visible.
    • Page_Unload

Hence when the button is clicked you will see the label for a nano second and again it gets disappear.

// ------------------------------------------------
function Hide()
{
document.getElementById('Label1').style.display='none';
}

function UnHide()
{
document.getElementById('Label1').style.display='block';
}
// ------------------------------------------------

Hope it is Clear.



Page Events for Server and Client :

Page Events for Server and Client :

--------------------------------------------

  • Page_Init
  • Page_Load
  • Page_PreRender
  • body_onload_clientside
  • Page_Render
  • Page_Unload

-------------------------

  • button_clientside_click
  • Page_Load
  • Button_ServerSide_Click
  • Page_PreRender
  • body_onload_clientside
  • Page_Render
  • Page_Unload

Hope it might clear a very basic doubt.


ResourceManager vs GetLocalResourceObject

Posted by me on ASP.Net Forums

-----------------------------------

Major difference lies in the kind of project you are in.

If you are in a Class Library project, where the resource files are stored as Binary files rather than XML file, you can only use ResourceManager and not the GetLocalResourceOject to extract the value from the Resource bundle.

Else, If you are into some Web Solution, where the resource files are stored as XML files rather than Binary file, you have to use GetLocalResourceOject .

Summary is :

  • ResourceManager can only extract resources from the Binary files [.resources] and not from XML files [.resx]. See below Note....
  • GetLocalResourceOject, opposite of above.

Note : if you try to extract resources from .resx file using ResourceManager, you will face below error.

"Could not find any resources appropriate for the specified culture or the neutral culture. Make sure "CountryNames.resources" was correctly embedded or linked into assembly "App_Web_translation.aspx.cdcab7d2.pj5mpytf" at compile time, or that all the satellite assemblies required are loadable and fully signed."

Hope it might help you to know the difference.



Wednesday, March 28, 2007

Sequencial Steps to change the name of SLN file

Follow below steps.

  1. Assign new name to the Virtual Directory.
  2. Edit the name of Project File (.proj) according to the new name of the virtual directory.
  3. Edit the name and contents of the .csproj.webinfo file.
  4. Edit the name and contents of the .sln file.