|
Hi,
Try using the following
System.Configuration.ConfigurationSettings.AppSettings("ConnectionString").ToString()
and in app.config
<appSettings>
<add key="ConnectionString" value="Data Source=MyData;Initial Catalog=Data;Integrated Security=False;User id=abcd;Password=1234;"/>
</appSettings>
|
|
|
|
|
ConfigurationSettings.AppSettings("DBConnectString") returns NOTHING
- Regards - J O N
A good thing is a bad thing if it keeps you from the best thing. - Dr. Adrian Rogers
|
|
|
|
|
Paste the code of your app.config and the code which you are calling to access it
|
|
|
|
|
hello, guys . i'm new with asp , i just wrote some noob pages (a master and a normal one) and i want to publish it (just to test it ) . I have a domain on .net , i've copied the files (.aspx , .master ) to it (i've also named one index.aspx) , but it does not work and i'm clueless . it says "The website declined to show this webpage " blah blah . Do i need to make an index.html make and then redirect that to the aspx file ? if yes , how ?
and do i need to redirect it to my computer (server) or can the host do the job for me ?
|
|
|
|
|
Hi,
does the server supports ASP.NET? Not all servers are set up to run .NET pages. (You don't need an index.html or something like this).
Regards
Sebastian
|
|
|
|
|
well , it only says about php . I suppose it doesn't (i'm not sure because someone bought it for me and i didn't have to chose it's issues).
So.. am i now suppose to redirect it to my computer or something ?
|
|
|
|
|
You could try it, but that's just for testing purpose I think. If you want to host your sites permanently you have to look out for an ASP.NET Provider.
|
|
|
|
|
hmm.. i see . another question : is it a good ideea to redirect it to another server (on another machine) , which will be working 24h/24h ? i mean .. will it change the url seen by the client ? (www.myactualdomain.net --->www.theotherserve.blahblah... )
(i'm sorry i'm having such a hard time understanding this , i've only dealed with programming desktop applications)
|
|
|
|
|
Hi, the first problem is that the ip of your pc will change after every disconnect. This means you have to change the redirection. Snd problem I see is, that if you don't have a domain, it will look like this "http://210.32.100.1/MyWebSiteTest".
You could have a look at a technique called DynDNS. This will map a fixed domain to a dynamic ip address. But after all, I think the url change will be seen by the client.
Regards
Sebastian
|
|
|
|
|
The point is that i might find someone running a server , with a real static ip . So.. can i use this server , and still have my actual domain to redirect from? (i'm not sure i'm making myself clear.. So .. can the use just type www.mycurrentdomain.net - which is on this current host that doesn't support asp.net and then be redirected to another server - a real one , with a static and real ip which DOES support asp.net?) I just want the both : this current domain AND asp.net facilities
|
|
|
|
|
Yes you can redirect from the php-server to the asp.net-server without a problem (just a small php-script for redirect etc.). But the user will see the redirect, because the url will change. You could try to hide this by running the asp.net site within a frame (have a look at html-frames). Then the url change will not be so obvious.
|
|
|
|
|
Thank you so much,SeMartens ! i'll do what i can ; you defenitely made it clear to me
|
|
|
|
|
I have a gridview that row's cells contain textboxes. Currently, I highlite the row, in yellow using javascript, by changing the backgroundColor of each of the rows cell's textboxes. To set the backgroundColor I use the .childNode[0].style.backgroundColor = 'Yellow', see code below:
gridViewCtl.rows[index].cells[i].childNodes[0].style.backgroundColor = 'Yellow';
Now, I have a set of css files defined and would like to use a color defined in my css. Does anyone know how this can be done?
Thanks,
Steve
|
|
|
|
|
CSS:
.whatever { background-color: #ffff00; }
...
JS:
gridViewCtl.rows[index].cells[i].childNodes[0].className = 'whatever';
|
|
|
|
|
I am using .className and setting my CSS value; however, the value is not being picked up. I ran into a similar problem because I had a default .skin for textboxes. In this case I'm not sure why it is not picking up my CSS tag value.
Thanks,
Steve
modified on Tuesday, October 21, 2008 3:33 PM
|
|
|
|
|
The problem was that I was setting the controls backgroundColor using .style.backgroundColor = 'White' before I was setting the .className using css. When I used .className with both 'NormalWhiteBackColor' and 'YellowBackColor' css, things worked fine.
|
|
|
|
|
Hello
I am using this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script language="javascript">alert('" + ex.Message.Replace("'", "") + "');</script>"); to show errors on an aspx webpage which are caught using a try catch block.
When the error message contains "\r\n" it throws an Unterminated String Constant error in javascript.
I can resolve this quite easily using this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script language="javascript">alert('" + ex.Message.Replace("'", "").Replace("\r\n", @"\n") + "');</script>");
Does anyone know a more elegant solution to this though, as i presume "\n" etc. also might cause the same problem?
Thanks
|
|
|
|
|
|
Sorry I think you misunderstood me... for e.g. error message "Index was out of range. Must be non-negative and less than the size of the collection.\r\nParameter name: index" renders as:
alert('Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index');
It should render as:
alert('Index was out of range. Must be non-negative and less than the size of the collection.\nParameter name: index');
so as not to throw a javascript error.
I suppose I could use this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script languaue="javascript">alert('" + ex.Message.Replace("'", "").Replace("\r", "").Replace("\n", @"\n") + "');</script>");
Just thought there might be an easier solution...
Thanks
|
|
|
|
|
Use "\\n" . That makes the first two slashes the escape sequence, and the n a plain character.
|
|
|
|
|
To properly escape a string value that you put in a javascript string literal, you replace \ with \\ and ' with \'. Before that you can replace a line break with the escape code \n.
And don't use the language attribute in the script tag. It's been deprecated for many years.
this.ClientScript.RegisterStartupScript(this.GetType(), "Message", "<script type="text/javascript">alert('" + ex.Message.Replace("\r\n", @"\n").Replace(@"\", @"\\").Replace("'", @"\'") + "');</script>");
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
How to write client-side validation code?
E.G.
a page has a dorpdownlist(identityDdl), a TextBox(identityTxt) and a TextBox(remarkTxt)
identityDdl has 3 items: Indentity Card, Martial Certificate and other
when selected "Indentity Card" or "Martial Certificate " check id of the correct format use CustomValidator on client, when selected "other" dont check.
if the characters more than 300 of remarkTxt.
With CustomValidator How to validat on client?
How to verify the results back to the CustomValidator?
Thanks.
|
|
|
|
|
You can use javascript for it.get the control by its ID,then check the value and for correct format you can REGEX.
Cheers!!
Brij
|
|
|
|
|
I saw so many people write like this:
<script type="text/javascript">
function valComments_ClientValidate(source, args)
{
if (args.Value.length > 10)
args.IsValid = false;
else
args.IsValid = true;
}
</script>
But I try it not successful.
How to setting the page validat is true or false?
|
|
|
|
|
This looks OK. Do you have firebug installed? If yes, try to debug your JS.
|
|
|
|