|
The thing is that is not validation only. There is behavior. New controls are created on the fly based on the users decision to input other fields.
All of these are based on complex business rules implemented with the help of full blown object orientation design.
Edit:
Sorry, forgot thank you for your input.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
You can do wildcards with jquery, or bind certain control types to validate functions, and javascript does support regex.
As far as dynamic controls goes, you make dynamic javascript.
|
|
|
|
|
Thanks again for your input, I'll certainly consider it, but I don't think I can replicate the business rules with regex and jscript without making a big mess and having a high risk of not reflecting the real underlying business model.
If I try to do it I may endup have an entire business model based on javascript. And that's what I am trying to avoid.
Thanks again for your input.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
So you finally got bit by the Update Panel and Microsoft Validators.
I dumped the use of them 3 years ago, and now I plan everything without them.
I learned that lesson the hard way, and had to rewrite everything with a whole new way of thinking.
I had a problem with the update panel being sort of jittery, and the user was never sure if the click went through. The progress indicator took too long on the round trip from the server, and needed to be instant.
All you can do is keep the code and use Akamai Edge Technology, or shift it all to JQuery, or a mixture of both.
As long as the user sees something happening right away, they will wait. They just need a signal. Basically you need to smooth out your gig, so it's silkly smooth looking, while the background transmissions can be erratic.
|
|
|
|
|
jkirkerx wrote: So you finally got bit by the Update Panel
Definitelly...
jkirkerx wrote: I learned that lesson the hard way
I'm thinking that might be my case as well, couz I don't have time to rewrite everything. I'm trying to think of a solution that does not cost me a lot of time and improve the performance.
jkirkerx wrote: As long as the user sees something happening right away, they will wait.
They can't wait in banking business. If it takes too long, it won't work, because you know, time is money. Imagine having to fill 30+ fields and having to wait 2 to 4 seconds for everyone of them. The processing indicator doesn't help with that
I wish I could touch the infrastructure to work it out, but I can't. Well, I'll keep thinking and maybe there will be a solution sometime. To me, the best thing is if the code behind could be cached locally (can it?) to avoid the roundtrips, that would solve my problems.
Anyway, thanks for the suggestions, wish me luck
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
No it can't be cached locally, because only the server can process asp.net code, the browser only supports script like Javascript and Jquery. There are some other scripts that can be ran, but it's still script.
I use Jquery now, and web services to replace the update panel.
I've worked with Google Maps, AdSense, You Tube, and noticed that they use tons of Javascript with web services. Check out a You Tube interface, when your on the movie, above the movie is a javascript / json web service that populates the posters movie collection. It's true data on demand, so the initial page load is only visible data, but you can open a container, and that container will populate on demand, providing more data only if needed.
[ Concept ]
You could build a base structure or framework container with asp.net, and populate or paint that container with Javascript that produces new html objects dynamically, validate with a new set of javascript, and then send the anwsers back using a web service. With Javascript, you can wipe the container clean, get a new set of controls via web service, and repeat the process.
Just keep the information on tap for the future, the next time you write a web based app, you may want to consider doing it the Google way.
I think that half of the Microsoft controls were developed in house as a quick way to provide more features, but were never really tested in a production environment, in which they are too slow, or just unstable.
|
|
|
|
|
jkirkerx wrote: No it can't be cached locally, because only the server can process asp.net code, the browser only supports script like Javascript and Jquery. There are some other scripts that can be ran, but it's still script.
Of this I'm aware, I was thinking more like a a local web server, like a plugin or something...
jkirkerx wrote: Just keep the information on tap for the future, the next time you write a web based app, you may want to consider doing it the Google way.
I'll certainly consider it.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Use Javascript Validation on controls, that works on client side only.
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
I'll try to condense this as much as I can and include only the relevant information.
This works:
protected void Page_Load(object sender, EventArgs e)
{
string hey = "<script language=JavaScript>alert(\"Agh!\");</script>";
this.RegisterClientScriptBlock("key", hey);
... much snipped for brevity ...
... but this doesn't:
... in Page_Load():
Button saveStart = new Button();
saveStart.Text = "Save";
saveStart.Click += new System.EventHandler(Save_Click);
}
protected void Save_Click(object sender, EventArgs e)
{
CheckInitialization();
... much snipped for brevity...
protected void CheckInitialization()
{
if (i == 64)
{
string hey = "<script language=JavaScript>alert(\"Agh!\");</script>";
this.RegisterClientScriptBlock("key", hey);
... much snipped for brevity...
Any idea why not? I've run it through the debugger and verified that the "if" conditional is entered. For some reason, though, I don't see the alert box in the second code.
Am I opening it on the server, perhaps? If so, what can I do with RegisterClientScriptBlock to get it to run on the client?
I'd appreciate any insight you could lend.
|
|
|
|
|
Hi there...
( I m not expert but I will try my best )
In the second one, u have created a button and initialised its click event.. but how will this click event gets fired ?? how will this click event gets triggered ???
so, the second code will not work as that alert is in click event and click event is not getting fired..
If u want the click event to get fired, please add this button to some panel or to some div or to placeholder as per ur comfort...
hope I made some sense...
|
|
|
|
|
Thank you for your reply.
Unfortunately, I can verify that the click event does fire, since it reaches a breakpoint I place on the "if" statement whenever I click the button.
|
|
|
|
|
This will register the script in the head tags
You can replace the embedded url with a static url
Dim cs As ClientScriptManager = Me.Page.ClientScript
Dim rsType As Type = Me.GetType()
If (Not cs.IsClientScriptIncludeRegistered(rsType, "jquery")) Then
cs.RegisterClientScriptInclude("jquery", cs.GetWebResourceUrl(rsType, "Admin_PM_Standard.jquery.js"))
End If
[EDIT]
try and use Page_Init instead of Page_Load
|
|
|
|
|
Hello,
I've been looking all over the web for a solution to this problem. I'm trying to find all the control IDs on a specific page from a different page when I pass the page's name. For example, I open Page1.aspx and I click on a button to get a list of control IDs on a second page Page2.aspx.
I found the following code on the Internet but I keep getting errors when I run it. I believe this code tries to open an instance of the page into memory, read the control IDs, and then close the page. However, I keep getting an error "Validation of viewState MAC failed".
Type type = BuildManager.GetCompiledType("~/Page2.aspx");
if (type != null)
{
Page myPage = (Page)Activator.CreateInstance(type);
myPage.ProcessRequest(HttpContext.Current);
}
I also have the following code for getting all the controls on a page from within the page (Page1.aspx). I need a similar code to get he controls on a different page.
private void getControlList(System.web.UI.Control control, ArrayList resultCollection)
{
foreach (System.Web.UI.Control childControl in control.Controls)
{
System.Web.UI.WebControls.WebControl webControl = childControl as System.Web.UI.WebControls.WebControl;
if (webControl != null)
{
resultCollection.Add(control.ID);
}
if (control.HasControls())
{
getControlList(control, resultCollection);
}
}
}
Any help is very much appreciated.
Thanks!
|
|
|
|
|
popup window is not working fine in chrome and mozilla, but its working fine in IE.
Could any one help me in that?
Thanks & Regards,
Member 3879881,
please don't forget to vote on the post
|
|
|
|
|
Not a good question. How can we possibly tell you what is wrong if you haven't told us what is going wrong; i.e. the specifics of the problem?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
Information is not appropriate but you can check for Pop blocker Setting in your browsers.
Turn Them OFF
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
Hi, Is the sample code to have a GridView with row insert and row footer to display totals. Thats a gridview with multiple row footers basically.
Please help.
Regards
Stagga
|
|
|
|
|
For an Idea you can workout with rowdatabound event of gridview
- Happy Coding -
Vishal Vashishta
|
|
|
|
|
Hi,
-- modified 21-May-12 13:44pm.
|
|
|
|
|
Member 3879881 wrote: my problem wil get resolved?
Since you haven't told what the actual problem is, the answer is maybe.
Failure is not an option; it's the default selection.
|
|
|
|
|
|
You're not getting it. "working fine" and "not responding well" tells us absolutely nothing.
If you want help then explain what is not working.
Failure is not an option; it's the default selection.
|
|
|
|
|
I have a form with auto postback set for custom validation on several text fields. It also has a list view of items which acts as a record selector to populate the text fields from a database when selected. The problem is that if I edit a text field and then click on the list view, the code behind for the text field runs and the listview returns to the previous selection which means the user has to click twice on the listview to select a new record. I'm sure there is a way to determine which option on the listview was clicked on and run the code behind for the listview after the code behind for the text box but I can't seem to find it. Doese anyone have any ideas or preferably a solution that they have implemented?
|
|
|
|
|
I have 2 textboxes and a button. for texbox 1 i have used a handler for autocompletion from database. and using javascript on key pressing "enter" key the focus changes to textbox 2.. in textbox2 textchanged event i am checking a value in database corresponding to the values in textbox1.
so on post back the focus is set to textbox1. i want to be on button1.
$(document).ready(function() {
$("#<%=textbox1.ClientID%>").autocomplete('../wholesalers/Handler.ashx');
});
$(function() {
$('input:text:first').focus();
var $inp = $('input:text');
$inp.bind('keydown', function(e) {
var key = e.which;
if (key == 13) {
e.preventDefault();
var nxtIdx = $inp.index(this) + 1;
$(":input:text:eq(" + nxtIdx + ")").focus();
}
});
});
protected void Page_Load(object sender, EventArgs e)
{
lbl_Wname.Text = Request.QueryString["name"];
if (!IsPostBack)
{
textbox1.Attributes.Add("onkeypress", "returnSetfocus(event,'" + textbox1.ClientID + "')");
}
else
{
button1.Focus();
}
}
protected void textbox2_TextChanged(object sender, EventArgs e)
{
if (textbox2.Text == "" || textbox2 == null)
{
ScriptManager.RegisterStartupScript(this, GetType(), "error", "alert('Enter Quantity');", true);
}
else
{
MySqlConnection mcn = new MySqlConnection("server=localhost;---------------------");
mcn.Open();
MySqlCommand cmd = new MySqlCommand();
cmd.CommandText = "searchp";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = mcn;
cmd.Parameters.Add("p_product_name", MySqlDbType.VarChar).Value =textbox1.Text;
DataTable dt = new DataTable();
MySqlDataAdapter ada = new MySqlDataAdapter(cmd);
ada.Fill(dt);
if (dt.Rows.Count > 0)
{
string sts = dt.Rows[0]["status"].ToString();
if (sts == "available")
{
Image1.ImageUrl = "~/images/tick.gif";
}
if (sts == "not-available")
{
Image1.ImageUrl = "~/images/cross.gif";
}
}
button1.Focus();
}
}
|
|
|
|
|
|