|
write
string sImageName = Request .QueryString["sImageName"]
and now check it out
Mahendra
|
|
|
|
|
sImageName = Request.QueryString("sImageName"))
Always use request.querystring to get data from url.
Do good and have good.
|
|
|
|
|
I seem to recall using an ErrorProvider component back in the day with ASP.NET 1.1 has that been toasted to be replaced by the Validators or have I just gone blind or...? From what I recall it was pretty open to how it was used.
I need to do all validation at the server dynamically after post back because the errors come out of custom business objects and are localized for the user and can be complex and most importantly are already in place and working in a winform app and are not to be messed with.
Scneario: the user posts back, I move their input into the business object, the business object either says ok can save or it has broken rules which I can access and matchup to each control that has a broken rule (is invalid).
Can I then add a validator to the form for each broken rule populating it with my error message as appropriate and send that back to the user so they see the rule and the red invalid icon etc and can fix, repost and I can then check it all over again?
|
|
|
|
|
I usually handle validation in 2 ways in asp.net...
1. I always check for basic field format (i.e. is it a phone number, zip code, email, etc) using the asp.net validator controls (i tend to use the customvalidator one almost all the time as I have a validation javascript that I include). I usually put a validation summary at the top of my forms to display all these field format errors. These are just sanity checks.
2. For business logic validation that happens on the server, I include an asp.net label where I output the business logic error/s. So my form postsback and I run bl checks. If they fail, I set the label to visible and set it's text to the error and stop the processing (i.e. I don't call save for instance). The only tricky thing with the label is to make sure you set it to not visible if your bl passes, especially if you don't redirect after your save.
Usually I create an 'error' class in a stylesheet and set my label and validators to use it. Or skin the validators if you're in asp.net 2.
I also tend to use a home grown custom server control, my 'errorcontrol' that includes this label and the validation summary. And usually has a 'seterrortext' method on it. I use this to simplify some of it.
You could play with the 'server validate' part of the validator controls but they are typically (I believe) tied to a specific control and not well suited for overall (across controls) form validation.
|
|
|
|
|
Ok, cool, thank you.
That gives me some ideas.
The more and more I experiment with asp.net 2 the more I find it simpler to just bypass a lot of the built in functionality and components and do it myself.
Almost every new feature seems so tightly wired to a concept of using direct database access from the web page and editing nearly anything through some sort of grid like control that it's too much of a fight to work with it using custom business objects.
thanks again.
|
|
|
|
|
Hi, good day!
May i know how to insert 2 data key in by user in the textbox into database. I'm using ASP.Net 1.1 and MSSQL2000. Can anyone give me the solution.
Thanks!
Best Regards,
Pei Sun
|
|
|
|
|
can u plz make the question more clearer. by the by do u want the SQL query for inserting or do u want to know how to pass the value to SQL query.
Vipin
|
|
|
|
|
u can use google or baidu.com. there're more correct answers
for example:
string sql = string.Format("INSERT INTO Table(vl1, vl2) VALUES('{0}', '{1}')"
, txtbox1.Text
, txtbox2.Text
);
then defined sqlconnection,sqlcommand etc, open the sql database.
then u could be get the results of sql command
|
|
|
|
|
I have a treeview on my page and when I expand the node and click a child node it returns the page with the treeview colapsed. I want to keep the treeview in the state the user has it opened. Thanks for everyones help in solving my dilemna.
|
|
|
|
|
Could you be more specific about which treeview control are you using ( Microsoft TreeView or TreeView in .Net 2.0, or a third party control ...)? And what does your code look like?
|
|
|
|
|
You have to expand the node of the tree on next page using your code. You have to expand the node explicitly.
Do good and have good.
|
|
|
|
|
i'm trying to call GridView.Render() on a webform, but i always get an error saying "that i must place my control in a form with runat='server'" however am sure that my control is in a form and also set to runat server, i'm also sure that the GridView don't have any other asp.net child controls like checkbox added to it,
i just want to mention that it works fine in .NET 1.1 using datagrid or any other control but it don't work in .NET 2.0
so, is it a bug ? or i'm doing somethin wrong ?
well, i hope to find a solution
thanx in advance.
|
|
|
|
|
There is a slight difference in the .NET 2.0, you will need to override the Page.VerifyRenderingInServerForm method in the web page and simply return true .
|
|
|
|
|
that make sense
thank u very much
|
|
|
|
|
Hi, I wanna know how to upload the .aspx files. I am upload the whole files (my project) onto an ftp. then i am using a domain to show the index.aspx. the database is with them. but the data isn't showing from the database + that the index.html is showing a blank screen! why is this??
This error is showing all the time when i am calling the index.aspx:
Runtime Error
configuration
system.web
customErrors mode="Off"
system.web
configuration
Adrian De Battista: .Net Programmer, Java Programmer and Web Designer.
|
|
|
|
|
Do as the information page says, and you will se the error message instead of the information page.
---
b { font-weight: normal; }
|
|
|
|
|
Our web server runs out of memory every so many hours. We scheduled IIS restarts every 4 hours.
Any ideas on how we can figure out why the server runs out of memory so fast?
|
|
|
|
|
There are a couple of things that you may want to do:
+ Attach more RAMs
+ Check the IIS configuration.
+ Investigate your code that may eat much of the memory.
|
|
|
|
|
...
Hossein
modified 15-Jul-20 21:01pm.
|
|
|
|
|
You can't use it in .NET 1.1 or 1.0, but you can use a regular expression validator to validate your input.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Like Christian said, you can use the RegularExpression validator to validate the input textbox control, another option is that you can use a third party component that is available out there. You do it yourself and you need know javascript well enough.
|
|
|
|
|
One of my co-workers wants to name C# functions in the presentation layer the same name as the stored procedures these functions call in the data layer. He says it's easier to debug issues this way. Any thoughts on whether it's a good or bad idea?
|
|
|
|
|
Why would you have functions mapped to stored procs in the presentation layer at all ?
It's a bad idea that you map directly to functions at all, there's no seperation if your presentation layer assumes that the data layer is implimented a certain way. For example, if I have an entity called a Car, then my presentation layer should make calls like
Car car = new Car(myCarID);
and
car.Make = Cars.Honda;
car.Year = 1996;
car.Save();
The car class encapsulates the details of how it stores and loads it's data.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Name the methods after what they do, not after what stored procedure they use at the moment. If you decide later that a method should use a different stored procedure, you would have to rename the method and change every call to it to match.
Some methods will correspond directly to a stored procedure, if they are named well you should easily be able to see the similarities in the names.
The fundamental idea of layering applications is that the presentation layer should be independent of the data layer. If your team isn't prepared to separate them, you shouldn't be building a layered application at all.
---
b { font-weight: normal; }
|
|
|
|
|
Hi,
I have developed an asp.net website using vstudio 2005. But in order for the website to run properly, I have to run it from visual studio itself.
When I typed the webaddress directly into the web browser's address bar (http://localhost/User.aspx), the website is unable to work correctly.
What should I do to enable the user to access the asp.net website directly via a browser without the need for visual studio?
|
|
|
|