Tuesday 26 October 2010

Some Javascript Questions

4 Quick Answers
4.1 How do I protect my javascript code?
4.2 How can I disable the back button in a web browser?
4.3 How can I access the client-side filesystem?
4.4 How can I see in javascript if a web browser accepts cookies?
4.5 How can I protect a webpage in javascript?
4.6 How do I convert a Number into a String with exactly 2 decimal places?
4.7 Why does 5 * 1.015 != 5.075 or 0.05+0.01 != 0.06?
4.8 How do I communicate between frames in a web browser?
4.9 How do I find the size of a browser window?
4.10 How do I check to see if a childwindow is open, before opening another?
4.11 Why does framename.print() not print the correct frame in IE?
4.12 Why does parseInt(ཅ') give an error?
4.13 How do I get the value of a form control?
4.14 How do I close a window and why does it not work on the first one?
4.15 How do I modify the current page in a browser?
4.16 How do I trim whitespace - LTRIM/RTRIM/TRIM?
4.17 How do I force a reload from the server/prevent caching?
4.18 How do I get a perl/asp/php variable into client-side js?
4.19 Why do I get permission denied when accessing a frame/window?
4.20 How do I make a 10 second delay?
4.21 Why does 1+1 equal 11? or How do I convert a string to a number?
4.22 How do I generate a random integer in [1..N]?
4.23 How do I change print settings with window.print()?

4.25 My element is named myselect[] , how do I access it?
4.26 How do I detect Opera/Netscape/IE?
4.27 How do I disable the right mouse button?
4.28 How do I change the confirm box to say yes/no or default to cancel?
4.29 How do I log-out a user when they leave my site?
4.30 How do I format Last Modified date with javascript
4.31 Why are my Rollovers so slow?
4.32 How do I change the text in the url/location bar?
4.33 How do I prompt a "Save As" dialog for an accepted mime type?
4.34 How do I run a server side script?
4.35 I have window.status="Moomin"; why doesn't the statusbar change?
4.36 How do I modify the current browser window?
4.37 How do I POST a form to a new window?
4.38 How do I download a page to a variable?
4.39 How do I access a property of an object using a string?
4.40 When should I use eval?
4.41 Why doesn't the global variable "divId" always refer to the element with id="divId"?
4.42 How do I open a new window with javascript?
4.43 How do I get my browser to report javascript errors?

4.24 I have what ... ?

Monday 18 October 2010

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, , >= or when the subquery is used as an expression.

i written the below query statement to sql server..

Collapse
SELECT ReferringPhysician.LastName,ReferringPhysician.FirstName,
(SELECT LocationName FROM RefPhysLocations WHERE ReferringPhysicianID = (SELECT ReferringPhysicianID FROM RefPhysLocations WHERE LocationName LIKE '%'+@keyword+'%')) AS LocationName
FROM ReferringPhysician
WHERE ReferringPhysician.ReferringPhysicianID=(SELECT ReferringPhysicianID FROM RefPhysLocations WHERE LocationName LIKE '%'+@keyword+'%')


But, i got the following error message from sql server.

Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery is used as an expression.

htmlfile:unknown runtime error

How do I solve following error message in Asp.net?



htmlfile:unknown runtime error

Accessing a DIV Tag with C#

this problem came the reason for Response.write is add to the c# code also not properly..so, i write the code infront of loop..

below code working properly.

Accessing a DIV Tag with C#


Response.Write("
"); // left:100px; top:100px; width:100px; height:100px; background-color:#ffffff; overflow:auto; scrollbar-face-color : #000000; scrollbar-highlight-color : #000000; scrollbar-3dlight-color : #000000; scrollbar-shadow-color : #000000; scrollbar-darkshadow-color : #000000; scrollbar-track-color : #000000; scrollbar-arrow-color : #000000;>");



for (int i = 0; i <>
{
mydata = InsCarr[i].InsCarrierName; // +"

";

if (ReturnTextbox != null && ReturnTextbox.Trim().Length > 0)
{

//Write to default page, with selection options.
if (MyDiv == null || MyDiv.Trim().Length == 0)
{
Response.Write("
"onmouseout=\"this.style.cursor='pointer';\"" +
"onclick=\"SetTextbox('" +
ReturnTextbox.Trim() + "','" +
mydata + "', '');\">" +
"");


}
else
{

Response.Write("
"onmouseout=\"this.style.cursor='pointer';\"" +
"onclick=\"SetTextbox('" +
ReturnTextbox.Trim() + "','" +
mydata + "', '" +
MyDiv + "');\">" +
"" + mydata + "" +
"
");

}
}
else
{
Response.Write("
" +
mydata + "
");
}

}
Response.Write("
");



}
else
{
return;
}

Tuesday 12 October 2010

Ajax Initialise

... ...



initialize to page load below:
Page_Load
---
protected void Page_Load(object sender, EventArgs e)
{
Ajax.Utility.RegisterTypeForAjax(typeof(RefPhy_Application_RefOutlook));
}



then add the code to aspx page:




Method..

[Ajax.AjaxMethod(HttpSessionStateRequirement.ReadWrite)]
public string SetStandardUrls(int officeId)
{
}



script
-------
RefPhy_Application_RefOutlook.SetStandardUrls(OfficeId, reloadContext_callback);


function reloadContext_callback(response) {
if (response.error == null) {
var result = response.value;
}
}

WEB CONFIG:

<>
//
<>
/
<>
/
..
< verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"> .. .... ...

Wednesday 6 October 2010

How to Use Viewstate?

public string EditOperation
{
get
{
return ViewState["EditOperation"] == null ? "" : (string)ViewState["EditOperation"];
}
set
{
ViewState["EditOperation"] = value;
}
}