Category Archives: Api

[RESOLVED] validation for money

Good morning all,

i have this validation for money value in textbox ^\d+(\.\d{1,2})?$.

Its working fine. for example if i enter 23.10 its fine.

but if i give .10 it does not work.

I want this to be worked if i dont put any ineteger before the decimal point like .20.


try this pattern 


Referenced Link:

hope it helps./.

try this too...


And also you can try....

Which is a free can build your own regex very easily....


[RESOLVED] How can you get the width of the browzer window with Internet Explorer 9.

 How can you get the width of the browzer window with Internet Explorer 9.  Old methods don't appear to work!

check this document.documentElement.clientWidth


You can use javascript or jquery api to implement it.

Check these links:

Hope this can help you.

[RESOLVED] System.Net.WebClient and some web clients I thought it was all Server Side

I have a webform that does a simple response.write in content type json format.  It works greats from every client I test it with - including a TinyWebDB API call from an Android phone.. but don't worry about that that API for this question.

I added some serverside code to that webform to read and scrape a web page as follows.

System.Net.WebClient myWebClient = new System.Net.WebClient();
Stream myStream = myWebClient.OpenRead(what);
StreamReader sr = new StreamReader(myStream);
string s = sr.ReadToEnd();

I test a call to my webform from IE, FF and Chrome.. all work great. However If I attempt to call the web form page from TinyWebDB the call works great and I get data back, but  I get a 404 error on the server side read of the webpage??

It's almost as if System.Net.WebClient is requires something from or is doing something on client itself.  i thought the reading of the page was all happening serverside and behind the scenes on my serer.  Why would my serverside code care about what browser or API initiated the call to the webform?

Should I be using another class?

Many Thanks.




WebClient.OpenRead use a GET method to do a request. What's the URI you called?

Maybe you can also Try HttpWebRequest class. This class is a general class to do a HTTP GET method.

                string path = "http://www.*.com/*.aspx";

                System.Net.HttpWebRequest webrequest = (System.Net.HttpWebRequest)System.Net.HttpWebRequest.Create(path );
                webrequest.Method = "GET";
                webrequest.AllowAutoRedirect = true;
                webrequest.Credentials = new NetworkCredential("username", "password"); //If you have a URI which requires authentication, you can give a NetworkCredential
                System.Net.HttpWebResponse myresponse = (System.Net.HttpWebResponse)webrequest.GetResponse();
                if (myresponse.StatusCode == System.Net.HttpStatusCode.OK)
                    using(Stream resStream = myresponse.GetResponseStream())
                    using (StreamReader reader = new StreamReader(resStream))
                        string readstring = reader.ReadToEnd();
            catch (WebException ex)
                if (ex.Response is HttpWebResponse)
                    switch (((HttpWebResponse)ex.Response).StatusCode)
                        case HttpStatusCode.NotFound:
                            Response.Write("page not found");


Hope this can help you.

[RESOLVED] Load part of html into IFRAME

I want to load part of a html-file (content.htm) in my project into an iframe in my main page (main.aspx).

Also, I want that content to take on the css, javascripts and filepath of the main page.

Is this even possible?

It seems iframe is almost a separate browser, and no settings from the main page will affect it. CSS does not work, nor does the filepaths since the content.html is located in a subfolder.

What approach should I use instead of Iframe?

Place the HTML Content in the User Control.

Place the User Control in the Main page


Creatoing a web user control and add the html markup or server control in it. Then place it on your main page. This is a good choice.

Create Web User Control:

Alternative way, you can consider to use javascript or jquery to load a page dynamically.

You can have a look at these article:

Hope this can help you.