|
|
I can setup validation group for all the controls. However, how will that help here?
|
|
|
|
|
i want to know how can I make the footer row at the bottom of the page even if the content is less? I tried this code but the footer is still not coming the bottom?
<asp:Table ID="Table1" runat="server" BorderWidth="1" CellPadding="5" Width="960px" Height="100%" HorizontalAlign="Center">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center"><uc1:website_header ID="websiteHeader" runat="server" /></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><uc1:main_menu ID="mnuMain" runat="server" /></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell><asp:ContentPlaceHolder ID="MainContent" runat="server"/></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Center" bottom:0px;"><uc1:Website_footer ID="Website_footer" runat="server" /></asp:TableCell>
</asp:TableRow>
</asp:Table>
|
|
|
|
|
how to register ASP.Net webform route when the url pattern and physical file is not available in registeration time. What I need to do is get the site url and check the database to find the physical file and the query string.
If I use routes.MapPageRoute("AllURLs", "{*page}", destinationUrl) I don't know how to get the destinationUrl from database for the requested url?
I hope this is clear. Please help me.
|
|
|
|
|
I don't understand the database part.
Are you going back to a SQL Server Database, to fetch data?
In asp.net 4.0, you build a route table, and store it in the global.asax, or you can store the table and rules in a class file, and point to the class in the global.asax.
The route table contains the rules to build the routes, when users access the website, and contains the rules to create the routes, for creating internal links.
Now you have to hook it up to IIS7+ in order to get it to work. You have load a module to support routing I believe.
If my memory serves me correct, asp.net 4.0 routing only works on Windows Vista and Windows 7, or IIS7 and IIS7.5 and up.
I don't have any route maps handy at the moment, because I already have some huge project loaded at the moment.
|
|
|
|
|
Please help me on my issue below;
I am working on an application to replace URLRewrite with ASP.Net 4 Routing. The requirement is to get the context.Request.RawURL runtime and check the URL in the database to find the physical file (ASPX form) and render that page.
This is what I have done but not sure how to render the page without redirection.
public class WebFormRouteHandler : IRouteHandler
{
public System.Web.IHttpHandler GetHttpHandler(RequestContext requestContext)
{
return new WebFormHandler();
}
}
public class WebFormHandler : IHttpHandler
{
public bool IsReusable
{
get { return true; }
}
public void ProcessRequest(HttpContext context)
{
string url = context.Request.RawUrl;
var destinationURL = GetFromDatabase(url);
context.Response.StatusCode = 301;
context.Response.AppendHeader("Location", destinationUrl);
return;
}
}
And In global.asax.cs :
public static void RegisterRoutes(RouteCollection routes)
{
var route = new Route("{language}/{*page}", new WebFormRouteHandler());
routes.Add(name, route);
return route;
}
So I want to get the requested URL and look at the database to get the physical file. The physical file may come with query strings. The way I have done above is not good because I am redirecting and mainly it doesn't work.
Please help.
|
|
|
|
|
I want to send sms through asp.net. Can anybody give me working code please.I want it urgent
|
|
|
|
|
You will have to use a sms gateway. That's your first step. After that you will have to read their api documentation to figure out how to create the code you need. Sms gateway providers have different api's so it's impossible to help you with code before you choose which gateway to use. Google "sms gateway api"
--------------------
When Chuck Norris' dreams come true, your worst nightmares begin.
|
|
|
|
|
You have posted this question in three forums; please read How to get an answer to your question[^], and post in one forum only.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Countered the 1 vote
C# has already designed away most of the tedium of C++.
|
|
|
|
|
Thanks, amazing how angry some people get when we won't do their work for them.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
To send sms though code you will need some third party sms gateway provider.
the code will differ for all the service providers but it will be very simple and the integration will be matter of minutes. I suggest you try to find some third party sms gateway provider that fits your needs and then implement the functionality as per its API.
Every now and then say, "What the Elephant." "What the Elephant" gives you freedom. Freedom brings opportunity. Opportunity makes your future.
|
|
|
|
|
you need to buy sms pack from like www.smsgatewaycenter.com these websites also provide developer code you have just to apply it
you need to search first
|
|
|
|
|
At my company I am told that I need to setup a web service with an 'xsd' file I will be receiving tomorrow morning. I have a visual studio.net 2010 professional version development software to work with and I have experience using C# 2010.
Since I have not setup a web service before, I am wondering how to setup the web service from scratch? All I want to do is have the web service that only works with the *.xsd file.
Thus can you tell me and/or point me to a reference on how to setup this web service?
|
|
|
|
|
hello
i published my website and hosted on IIS.when i run the site as http://localhost/employee/emp.aspx ,every thing goes fine.it displays the page.
But when i run it using my system ip address as http://10.40.5.140/employee/emp.aspx , it displays
'You are not authorized to view this page
You do not have permission to view this directory or page using the credentials that you supplied.
Please try the following:
Contact the Web site administrator if you believe you should be able to view this directory or page.
Click the Refresh button to try again with different credentials.
HTTP Error 401.1 - Unauthorized: Access is denied due to invalid credentials.
Internet Information Services (IIS)
Technical Information (for support personnel)
Go to Microsoft Product Support Services and perform a title search for the words HTTP and 401.
Open IIS Help, which is accessible in IIS Manager (inetmgr), and search for topics titled Authentication, Access Control, and About Custom Error Messages.'
how to run i using my system ip address.
thank you.
|
|
|
|
|
|
How to populate data table in to jqgrid ? ? please help
Using Webservice or any other method?
|
|
|
|
|
The following is the code for combobox along with its custom validator
<asp:ComboBox ID="cmbBusinessOwner" runat="server" MaxLength="0" DropDownStyle="DropDownList"
AutoCompleteMode="SuggestAppend">
<asp:ListItem Text="--Select--" Value="0" />
<asp:ListItem Text="HDFC Co-op" Value="1" />
<asp:ListItem Text="Limited Dividend Co-op" Value="2" />
<asp:ListItem Text="Rent Controlled" Value="3" />
<asp:ListItem Text="Rent Stablized" Value="4" />
<asp:ListItem Text="India" Value="5" />
<asp:ListItem Text="United" Value="6" />
<asp:ListItem Text="America" Value="7" />
<asp:ListItem Text="Mexico" Value="8" />
</asp:ComboBox>
<asp:CustomValidator ID="cvRequired" runat="server" ValidationGroup="Continue" ForeColor="Red"
ClientValidationFunction="cvComboBox_Validate" Text="Select Business Owner" Display="Dynamic"></asp:CustomValidator>
the script for cvComboBox_Validate function is
function cvComboBox_Validate(source, args) {
var ComboBoxCtrl = $find('cmbBusinessOwner');
if (ComboBoxCtrl.get_textBoxControl().value == "--Select--")
args.IsValid = false;
else
args.IsValid = true;
}
This code gives me the error message "Select Business Owner" next to the control on button click. But the message "Select Business Owner" fails to appear in validation summary.
My validation summary is as follows
<asp:ValidationSummary ID="ValidationSummary1" runat="server" ShowMessageBox="false" EnableClientScript="true"
CssClass="validationsummary" ValidationGroup="Continue" DisplayMode="BulletList"
HeaderText="<div class='validationheader'> Please correct the following errors:</div>" />
Rest all the control on the page works fine except for this combobox.
Help will be greatly appreciated.
Thanks
|
|
|
|
|
It's been over 5 years since I've used one of those valicators, but on a dropdownlist, you have to add the default value to the validator for it to work on a dropdownlist. I don't remember the exact use, but I think it's
<asp:CustomValidator ID="cvRequired" runat="server" ValidationGroup="Continue" ForeColor="Red" defaultvalue="0"
ClientValidationFunction="cvComboBox_Validate" Text="Select Business Owner" Display="Dynamic"></asp:CustomValidator>
Without the default value, the validator has no clue what to validate.
|
|
|
|
|
Thanks for the reply.
The defaultvalue="0" does not work either.
The problem isn't that the validation does not work. It works fine. I see the message displayed next to the combobox control on button click.
The issue is that the validationsummary does not capture this custom validator.
|
|
|
|
|
[EDIT]
your missing the validation group on the combobox
[End of EDIT]
I've never used the validation summary, can't tell you why it doesn't work with the combo box.
All I can say is that you missing something, or mistyped a value like the validation group name.
I stopped using the validation controls about 4 years ago, because I found that they were unreliable, and got too many complaints about them. Across all the computers in the world, they just didn't work on all of them. Go Figure.
Now I do real time validation, in which I validate each time the field changes, and validate again before submission, and validate again on the server side. At the same time, I check for script injection, and correct values on the fly, or offer a list of suggestions.
All in Javascript.
|
|
|
|
|
real time validation --- sounds interesting..
can you given an example.... say with respect to a textbox..
how will you validate them with the different scenario you mentioned("I validate each time the field changes, and validate again before submission, and validate again on the server side. At the same time, I check for script injection, and correct values on the fly, or offer a list of suggestions.")
Thanks
|
|
|
|
|
i use jquery
I bind an event called blur to the textbox, when the user changes fields, the blur is fired, and validates the textbox. I can then format the data, if the value is not correct, then you can paint a red border around the entire area, and change the background color of the textbox.
A red border around the textbox is more visible and non-intrusive than a giant validation message.
A Jquery file designed to work with an update panel. It validate a textbox for an email address. This is one of the designs I use. I have many designs.
$(document).ready(function () {
initiateBinding();
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
});
function EndRequestHandler(sender, args) {
initiateBinding();
}
function initiateBinding() {
$(document).ajaxStart(function () {
});
$(document).ajaxStop(function () {
});
$('[id*="_txt_Email_Jquery_FriendsName_Field"]').blur(function() {
validate_Email();
});
}
function validate_Email() {
var validation_Flag = true;
var txtFocus;
var txtError;
txtFocus = $('[id*="_txt_Jquery_txtFocus"]').val();
txtError = $('[id*="_txt_Jquery_txtError"]').val();
var friendsName_length;
friendsName_length = $('[id*="_txt_Email_Jquery_FriendsName_Field"]').val().length;
if (friendsName_length < 2) {
$('[id*="_txt_Email_Jquery_FriendsName_Field"]').css('background-color', txtFocus).fadeOut("slow");
$('[id*="_txt_Email_Jquery_FriendsName_Field"]').css('background-color', txtError).fadeIn("slow");
$('[id*="_img_Email_Jquery_FriendsName_Error"]').delay(800).fadeIn(300).show("normal");
validation_Flag = false;
}
else if (friendsName_length > 2) {
$('[id*="_txt_Email_Jquery_FriendsName_Field"]').css('background-color', txtError).fadeOut("slow");
$('[id*="_txt_Email_Jquery_FriendsName_Field"]').css('background-color', txtFocus).fadeIn("slow");
$('[id*="_img_Email_Jquery_FriendsName_Error"]').fadeOut(500).hide("normal");
}
var emailAddress_length;
emailAddress_length = $('[id*="_txt_Email_Jquery_EmailAddress_Field"]').val().length;
if (emailAddress_length < 2) {
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', txtFocus).fadeOut("slow");
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', txtError).fadeIn("slow");
$('[id*="_img_Email_Jquery_EmailAddress_Error"]').delay(800).fadeIn(300).show("normal");
validation_Flag = false;
}
else if (emailAddress_length > 2) {
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', txtFocus).fadeIn("slow");
$('[id*="_img_Email_Jquery_EmailAddress_Error"]').fadeOut(500).hide("normal");
var re_EmailAddress = new RegExp("\\w+([-+.']\\w+)*@\\w+([-.]\w+)*\\.\\w+([-.]\\w+)*");
var txt_EmailAddress_Validate = $('[id*="_txt_Email_Jquery_EmailAddress_Field"]').val();
var match_EmailAddress = re_EmailAddress.exec(txt_EmailAddress_Validate);
if (match_EmailAddress == null) {
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', txtFocus).fadeOut("slow");
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', "#C6DEFF").fadeIn("slow");
$('[id*="_img_Email_Jquery_EmailAddress_Error"]').delay(800).fadeIn(300).show("normal");
$('[id*="_lbl_Email_Jquery_EmailAddress_Label"]').text("Your format is not valid! (eg. someone@domain.com)").delay(800);
validation_Flag = false;
} else if (match_EmailAddress !== null) {
$('[id*="_txt_Email_Jquery_EmailAddress_Field"]').css('background-color', txtFocus).fadeIn("slow");
$('[id*="_img_Email_Jquery_EmailAddress_Error"]').fadeOut(500).hide("normal");
$('[id*="_lbl_Email_Jquery_EmailAddress_Label"]').text("Enter your friends email address:").delay(500);
}
}
if (validation_Flag == true) {
$('[id*="_txt_Jquery_Approved"]').val("jquery_approved");
}
else {
$('[id*="_txt_Jquery_Approved"]').val("jquery_declined");
}
}
|
|
|
|
|
Thanks jkirkerx. I have no idea about J quey. But this gives me some idea as to what this code intends to do. I will do some research on what you suggested. Probably could incorporate in my project.
Appreciate it.
|
|
|
|
|
All the asp.net validation controls do is load some javascript or microsoft jscript, and run the regex that you assign to it against the textbox value. Then they display some text via javascript, with the text message you assign to it.
Computer users are not that smart, although they think there smart, and the UI (user interface) will become your biggest challenge. Writing a page application is half the battle, the easiest part. The hardest part is validating the form before submission.
If you can't convey the errors to let's say your mom, then the program is partially useless.
|
|
|
|