Always set default path to every Image and linkbutton control otherwise they refer current path automatically.
Thursday, November 26, 2009
Empty Image Path Issue
How to call Server Side function using ajax in asp.net
Using Web method we can call server side method from java script.
Use following link for more details.
"http://69.10.233.10/KB/ajax/ajax_server_side_call.aspx?display=Print"
Use following link for more details.
"http://69.10.233.10/KB/ajax/ajax_server_side_call.aspx?display=Print"
How to Set JS Path on Master Page for different level of content pages
1) Add a method in master page that include a script tag in header of page, like this: The two basic ways to solve this problem are:
Add a method in master page that include a script tag in header of page, like this:
private void addScriptInc(string path)
{
HtmlGenericControl script = new HtmlGenericControl(""script""); script.Attributes.Add(""type"", ""text/javascript""); script.Attributes.Add(""language"", ""javascript""); script.Attributes.Add(""src"", ResolveClientUrl(path)); Page.Header.Controls.Add(script);
}
or use the Page.ClientScript.RegisterClientScriptInclude method to add a script include inside body>form tags (i don't like this method)
2) Write the script tag like this:
The two solutions above can be used with other elements, like links, images, etc.
3) Register Script from server side.
String logOutJSPath = VirtualPathUtility.MakeRelative(Page.AppRelativeVirtualPath, ""~/JS/Logout.js"");
String logOut = """";
Page.ClientScript.RegisterStartupScript(this.GetType(), ""Logout"", logOut);"
How to disiable cut, copy, paste and selection operation in TextBox using JS.
use following inbuilt JS function.
oncut="return false"
oncopy="return false"
onpaste="return false"
oncontextmenu="return false"
onselectstart="return false"
How to prevent Insert Duplicate record into Database on Page Refersh.
Page_Load()
{
If(!Page.IsPostBack)
{
Session["update"] = Server.UrlEncode(DateTime.Now.Tostring();
}
}
Page_PreRender()
{
ViewState["update"].ToString() = ViewState["update"].Tostring();
}
SaveButton_Click()
{
If(Session["update"].Tostring() == ViewState["update"].Tostring());
{
-------------
-------
---
Session["update"] = Server.UrlEncode(DateTime.New.Tostring());
}
}
Navigation in Page using JS
Use "history.go(-1);return false;" to go back in browser based application.
"history.go(1);return false;" to go forward in browser based application.
How to preserve value at navigation time like on back button show previous selection.
Use Server.Transfer(url, true);
Wheres ture means Preservform value.
Subscribe to:
Posts (Atom)
