|
Hi,
I know it quite simple but how can I declare constants that should be used in my all aspx application.
I think it should be in global.asax but I don't know how to code it.
Thx.
|
|
|
|
|
It's easiler to add a Module to your project called MyGlobals and add them all in there.
Paul
|
|
|
|
|
I wonder if I have write access on my server and have a page that makes it possible for other people to upload files and other stuff into an XML file, just something.
How can do so only my homepage can upload stuff.. and not You with this kinda code eg.:
Console.Write("\nPlease enter the URI to post data to : ");
String uriString = Console.ReadLine();
WebClient myWebClient = new WebClient();
Console.WriteLine("\nPlease enter the fully qualified path of the file to be uploaded to the URI");
string fileName = Console.ReadLine();
Console.WriteLine("Uploading {0} to {1} ...",fileName,uriString);
byte[] responseArray = myWebClient.UploadFile(uriString,fileName);
Console.WriteLine("\nResponse Received.The contents of the file uploaded are: \n{0}",Encoding.ASCII.GetString(responseArray));
It was taken from MSDN Library and what I've figured out is that this code can upload a file to any address, only if it has write access of course!? Am I right?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I have a datagrid containing an EditItemTemplate column.
The column contains a textbox and a customvalidator control. The ClientValidationFunction on the customvalidator is calling the javascript function correctly and I can check the value entered into the textbox ok, however if the validation fails I need to set the document focus back to the textbox 'tdValue'. Does anyone know how this can be done?
The 'source.controltovalidate' javascript property will return me a value in the form - controlname_dgDatagridName__ctl3_tdValue but I do not know how to use this name value to call the tdValue.focus() method.
Any suggestions?
<edititemtemplate>
<asp:textbox id="tdValue" runat="server" text="<%# DataBinder.Eval(Container.DataItem, "tdvalue", "{0 .00}") %>">
<asp:customvalidator id="validate_tdValue" enableclientscript="true" runat="server" controltovalidate="tdValue" errormessage="My Error" clientvalidationfunction="CheckCurrency">
function CheckCurrency(source, arguments)
{
//Do my validation here
alert(source.controltovalidate)
}
Thanks
It ain't what you know that matters.
Uncle Monkey
|
|
|
|
|
Whoops heres the edititemtemplate that was supposed to be in the last message :P
<edititemtemplate>
<asp:textbox id="tdValue" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "tdvalue", "{0 .00}") %>' />
<asp:CustomValidator id="validate_tdValue" EnableClientScript="true" runat="server" ControlToValidate="tdValue" ErrorMessage="My Error" ClientValidationFunction="CheckCurrency" />
</edititemtemplate>
It ain't what you know that matters.
Uncle Monkey
|
|
|
|
|
I create a web service that return something like ramdom quotes,
But when I create an ASP.NET client web application to consume the web service and start the web app,
An error occurred,it said:
request because of status 401 failure:unauthorized.
And it red-colored my web method "this.Invoke("getquote",new object[0]).
What am I doing wrong?
Thanks in advance.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
Does this happen when running off your localhost?
Cheers,
Simon
"Sign up for a chance to be among the first to experience the wrath of the gods.", Microsoft's home page (24/06/2002)
|
|
|
|
|
Yes,Did you experience same problems ever?
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
Hi,
I've developped a small application on my computer. All is working fine. I've generated an installable package for that aspx application.
I've installed the application on another computer and now I got some cast error.
I've a webform with textbox control. One textbox value is used as parameter in a function. I force this value to be converted as Decimal.
myObject.insertValue(CDec(txtBox1.text))
If I enter the value 123.4, I got a cast error and if I enter 123,4 it's working fine . But I don't want comma in my number.
Can some know where the problem is from ? I've check regional settings but it's seemd to be OK.
Thx
|
|
|
|
|
I've found myself the solution.
The IIS service is not using the regional settings of the user but the .Default value in HKEY_USERS\.Default\Control Panel\International
As the compteur on which the application is running was previously set for French Language, it's necessary to adapte the key I gave before to the correct value.
|
|
|
|
|
Hi again...
OK , now I have this control inheriting from WebControl, so it makes sense to use its style properties. I far as I can figure, I need to do my rendering of the control by overriding RenderContents() so the SPAN tag incapsulate the contents I want to render.
The problem I am having is that the style settings as set by the Control in the SPAN tag is not "falling" thru to my rendering. Actually some does , and some dont. EG Font name does, fontsize does not. And my overriding of the style does not have an effect either.
What is the problem here? Any informative resources on this perhaps?
Any help appreciated
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
HI all
I have made a simple custom control. Just a table foreach entry I have in a collection. Now in design mode, after placing the control on the webform, I add some items to it and it works 100%. Then I build and the browser screams:
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: Cannot create an object of type 'XXXXXXX.EntryCollection' from its string representation '(Collection)' for the 'Entries' property.
Source Error:
Line 13: <body MS_POSITIONING="GridLayout">
Line 14: <form id="EntryForm" method="post" runat="server">
Line 15: <cc1:EntryView id="EntryView1" runat="server" Entries="(Collection)"></cc1:EntryView>
Line 16: </form>
Line 17: </body>
Then I have to basically remove every reference in the webform and add it again. And go thru the same &^%&% process. NO WTF is going on?
I have tried to change Collection to EntryCollection, same effect.
PLEASE HELP!PLEASE HELP!PLEASE HELP!PLEASE HELP!
[edit] Modify 1231: displaying without HTML!!!![edit]
<i>Give them a chance! Do it for the kittens, dear God, the kittens!</i>
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Some more Info
private EntryCollection entrycol;
public EntryView()
{
this.entrycol = new EntryCollection();
}
public EntryCollection Entries
{
get {return entrycol;}
}
This all work 100% in designer.
Now I build and run it.
Now it complains it want s a set property for Entries. Why?????????
But anyways, I add it a set property, then I get error as explained in previous post.
Why is ASP.NET so gay?
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
OK problem was that I inherited from Control, not WebControl...
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Hello
I’m perhaps a bit old fashion when it comes to ASP.
I try to build a Form populated whit Database data (from a Stored Procedure) and when I click the “save” button the data will be saved to the database thro a Stored Procedure.
But it won’t work, it looks as if the load event is fired before the button.click?????
|
|
|
|
|
That's correct. In the Page_Load event, check the Page.IsPostBack property. If the property is true, the form has been posted back and you don't need to populate it.
|
|
|
|
|
That's not what you would have figured if you are a old ASP-programmer like me. But It's kind of cool that I only hav to populate it ones.
Thanks
|
|
|
|
|
Hey:
i have a quicc question...:
i am trying to build an Online poll which, actually, i done. The issue is that in one particular part of my ASP code i am hitting a snag. This is the segment:
----
' Checc to see which value was selected by user,
' then increment that option's value by one.
CHECKER = Request.Form ("mysite_poll")
if CHECKER = "OPTION1" then
OPTIONVALUE_INSERT = OPTIONVALUE(0) +1
strINSERT = "UPDATE POLL1 SET OPTION1 = " & OPTIONVALUE_INSERT
OCONN.Execute(strINSERT)
^ THIS IS LINE 44 ^
elseif CHECKER = "OPTION2" then
OPTIONVALUE_INSERT = OPTIONVALUE(1) +1
strINSERT = "UPDATE POLL1 SET OPTION2 = " & OPTIONVALUE_INSERT
OCONN.Execute(strINSERT)
elseif CHECKER = "OPTION3" then
OPTIONVALUE_INSERT = OPTIONVALUE(2) +1
strINSERT = "UPDATE POLL1 SET OPTION3 = " & OPTIONVALUE_INSERT
OCONN.Execute(strINSERT)
end if
----
The error that i am getting follows:
----
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/specter1/asp/poll1.asp, line 44
----
This is recieved whenever i make a selection. Can you please help?
Thanks in advance,
-- e c l i p t o i d . 3 3 0
-- Web Developer
-- Interactive Designer
|
|
|
|
|
I have a div tag with a scrollbar. The standard scrollbar in IE that always is visible do I want a different color of than the color of the div tag's scrollbar!
So how to make the color of my div tag to red and the standard IE scrollbar to black?
Can I use CSS and specify the class to the scrollbars?! If you know what I mean!?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
So how to make the color of my div tag to red and the standard IE scrollbar to black?
Can I use CSS and specify the class to the scrollbars?! If you know what I mean!?
I answered effectively the same question down below.
|
|
|
|
|
Oh!
So I can do the same with div tags? Cool!
I will try it!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
http://www.gotdotnet.com/playground/services/QotD/default.aspx[^]
The web service only returns a random quote,
Does anyone give me guides that how to add the man head opening his mouth widely and shouting angry and the box that contain the quote?
Thanks.
this is my signature for forums quoted from shog*9:
I can't help but feel, somewhere deep within that withered, bitter, scheming person, there is a small child, frightened, looking a way out.
|
|
|
|
|
Hi folks,
I'm working on a webpage using a stylesheet - but when I've changed the stylesheet file and reloads the page - the changes aren't visible. If I close the browser and reopen it, changes in the file are reflected on the page.
I've set the "Tools->Internet options...->Settings (in the Temporary internet files section, on the General tab)->Check for newer version of stored pages" to "Every visit to the page", and this works fine for regular html and asp pages - but not for stylesheets. And I can't set the buffer used for file caching to anything below 1 MB.
So what do I do ? Any help is much appreciated.
/Jan
|
|
|
|
|
Clicking the Refresh button has always worked for me... even for style sheets.
Word of the day: Rotundacrat
Extra Credit will be awarded for: Quasimobo...
|
|
|
|
|
You could try holding shift or ctrl when you refresh (which forces the browser to do a full refresh and forget any cached content. different keys are used by different browsers, and I can never remember which is which)
--
Help me! I'm turning into a grapefruit!
|
|
|
|