Validator For Two Controls Dependent On Each Other?
Nov 10, 2010
I have a textbox and a datepicker control.The validator requires that neither can be selected. ie. both blank. However if one has a value the other must also have a value.
Can anybody tell me how to implement this given that a CustomValidator requires a RequiredFieldValidator to fire?
View 1 Replies
Similar Messages:
Dec 13, 2010
I have a validator on a textbox that validates against a list to ensure that the user doesn't input the same name. When testing it, if I type in the same name including the same case structure, it returns an error. If I change one letter to a different case, it doesn't return an error but rather my SQL server returns a duplicate error. How do I change the server-side validator so that it picks up duplicate names regardless of case?
View 4 Replies
Mar 15, 2010
I have this "how to" type of question. I have a page where there are four gridviews. Now these four grids pull data from four different tables. The 1st grid retrieves data from table 1 with a where clause in it's query that comes from a hidden fileld value in the page. Till this things are fine. However, the 2nd grid has a dependency on the 1st grid and the where clause in it's query should be the data selected in grid view1. The 3rd depends on the 2nd one..and so on.
View 2 Replies
Mar 21, 2011
1) I should have one table-like column, where data are taken from database. It should contain sorted surname-name.
2) Every surname-name is a link to another table-like control. Content of it depans on surname-name that was clicked. This table will contain relatives of particular person.
Say, I have a column with John Anderson, George Washington etc. I click John Andreson and another table load data (relatives of John Anderson) - Anegline Jolly, Peter Pan etc.Then I click George Washingto and another table load data (relative of George Washington) - Zera Zebra, Aflen Aleks etc. Every relative should have a checkbox nearby. So the second table-like control will look like:
Angeline | Jolly | <some other information from db> | <checkbox>
Peter | Pen | <some other information from db> | <checkbox>
etc.
3) I have a button "A-D", When it is clicked, then first table is populated only with surnames with first letter from A to D. I have a button "E-G". When it is clicked, then table is populated only with surnames starting with letters E to G. I have nevere used DataGrids and other db binding controls. Which of them should I use?
View 3 Replies
Apr 19, 2010
I am trying to make a routine system(school, college) where i will use three text field as input1> Class start time(input: 8:00 AM) // when school/college will start.2> Class ending time(input: 1:00 PM) // when all of my class will finish3> Duration of class(input: 1.5(hour))// class hourdesired output: A class routine where time(hour) will be shown in row and Day(e.g, sunday,monday) will be shown in column.questions:
1> how i'll take the input as time:hour from text field?2> how i can save the calculated time in database for use in other page?
View 3 Replies
Dec 23, 2013
How do I fill ProductNameID on selection of ProductCategoryID dropdown by passing
ProductCategoryID .SelectedValue...
aspx Code
<asp:GridView ID="gridPosition" runat="server" AutoGenerateColumns="False" ShowFooter="True" OnRowDataBound="gridPosition_onRowDataBound"
DataKeyNames="SaleDetailID" OnRowEditing="gridPosition_RowEditing"
OnRowCancelingEdit="gridPosition_RowCancelingEdit" OnRowUpdating="gridPosition_RowUpdating"
OnRowDeleting="gridPosition_RowDeleting" ShowHeaderWhenEmpty="True" CssClass="manage-admin"
Width="500px" GridLines="None">
[Code] .....
View 1 Replies
Jun 9, 2010
I am trying to highlight a cell in a DetailsView if the value displayed is either "Desktop Computer" or "Laptop Computer" say red, I seem to be able to find examples for gridview but I don't seem to be able to apply this to a DetailsView.
View 4 Replies
Jul 2, 2010
GridViewDetails uses templatefields. In edittemplate I put a button called "ButtonUpdateAdjustAmount" with OnClick="Update_AdjustAmount" in the EditItemTemplate for the "Amt to be Adj" column. There is also a textbox. My user's should be able to edit the textbox, but I also want the ability to click the button and the textbox populated with the correct calculated value. The formula varies based on the "code" column which is a dropdownlist called "DropListCode".
I am fairly new to asp.net, vb, etc...so forgive my code writing. Eventually I need to also put the same functionality on the insertrow for my gridview. But first wanted to get the edit one working. I am using templatefields for all columns and the FooterTemplate to perform the Insert New Detail Line.
I can get the functionality to work for the first data row and only if I take out the If code.SelectedValue = ... line and leave 1 static formula. However that isn't going to work. If DropListCode.SelectedValue is DNR then AdjAmt should be ((q_ordered - q_received) * cost). If DropListCode. SelectedValue is OV then AdjAmt should be (RKNumber * cost). If DropListCode.SelectedValue is NB the AdjAmt should be ((q_received - q_ordered) * cost). If DropListCode.SelectedValue is DAM then AdjAmt should be (RKNumber * cost)
Code behind for the OnClick:
[Code]....
.aspx page - GridViewDetails programming:
[Code]....
View 6 Replies
Jun 8, 2010
Iam trying to understand why my sqldatasource control bound to gridview will not return data while i have cascading dropdownlist coded in pageload and selected events respectively?
from which sqldatasource control stored procedure obtains its parameter values.
only when i select items from second dependent dropdown does the grid display data?
View 10 Replies
Dec 31, 2010
I using RangeValidator (0-10)gularExpressionValidator for text box ,Iam using regx for validate numeric characters
But if i enter charcters it will fire both RangeValidator and regx validator eventhoug i am enterd character,
i want to fire both validators seperatly
Here is my code
[code]...
View 8 Replies
Oct 27, 2010
I have a requirement of converting existing english form to multi lingual form.I am currently converting english form to spanish form.
Everything works except the date formats.
The range validator is not working in a spanish form but works in a english form.
I have set the maximum and minimum value in page load as below in the english form
Heres how i have set the values
[code]...
View 6 Replies
Mar 1, 2010
When it comes to field validation, when I use a Compare Validator to make sure a date is a date or a numeric field has a number, I must also use a Required Field Validator to make sure there is something actually enetered. In other words, the Compare Validator allows a blank value even though a blank is not a date or number or whatever.
Is using both a Required Field Validator and a Compare Validator the way to do this or is there some way to make the Compare Validator also require input of some kind?
View 3 Replies
Jan 5, 2010
I'm currently trying to work through MVC validation, and am coming up against some problems where a field is required depending on the value of another field. An example is below (that I haven't figured out yet) - If the PaymentMethod == "Cheque", then the ChequeName should be required, otherwise it can be let through.
[Required(ErrorMessage = "Payment Method must be selected")]
public override string PaymentMethod
{ get; set; }
[Required(ErrorMessage = "ChequeName is required")]
public override string ChequeName
{ get; set; }
I'm using the System.ComponentModel.DataAnnotations for the [Required], and have also extended a ValidationAttribute to try and get this working, but I can't pass a variable through to do the validation (extension below)
public class JEPaymentDetailRequired : ValidationAttribute
{
public string PaymentSelected { get; set; }
public string PaymentType { get; set; }
public override bool IsValid(object value)
{
if (PaymentSelected != PaymentType)
return true;
var stringDetail = (string) value;
if (stringDetail.Length == 0)
return false;
return true;
}
}
Implementation:
[JEPaymentDetailRequired(PaymentSelected = PaymentMethod, PaymentType = "Cheque", ErrorMessage = "Cheque name must be completed when payment type of cheque")]
Has anyone had experience with this sort of validation? Would it just be better to write it into the controller?
View 1 Replies
Oct 15, 2010
Can any 1 give a proper explanation of this
View 2 Replies
Nov 3, 2010
I'm working on an application (a web application, asp.net and c#) which is datetime-dependent, so, based on the current date, it will launch forms for the logged user to fill in.
I've been thinking about how we're going to simulate real usage of the application, for debugging and testing purposes.
So I'm talking about replacing all those:
DateTime currentDate = DateTime.Now;
with something like:
DateTime currentDate = MyDateClass.GetCurrentDate();
And then I'll have a class:
public class MyDateClass
{
private DateTime _currentDate;
public DateTime GetCurrentDate()
{
// get the date, which may be different from DateTime.Now
return _currentDate;
}
public void SetCurrentDate(DateTime newCurrentDate)
{
// set the date to the value chosen by the user
_currentDate = newCurrentDate;
}
}
allowing me to set the current data, by invoking the SetCurrentDate method, for example, in the code-behind of a link button and a calendar input.
how should I exactly store the DateTime variable, throughout all the application? I can't work with the session in this class, right? Should I work with the Thread?
[code]....
View 2 Replies
Jul 6, 2010
I have a validator callout extender that works, it shows the callout box. But, it does a postback. It didn't do a post back the first time I clicked the button but it did for subsequent times. I read on the AJAX site that a custom validator must be used with this for it to work. I'm currently using this with a required field and regular expression validator. It works, the callout appears, but it doesn't work every time with out the post back.I posted this to see if there is a way to get this to work with a required field and regular expression validator, with out using a custom validator. I'm using the newest release of the toolkit, so I thought the documentation may be old, since the callout is appearing.
View 8 Replies
Mar 12, 2010
I am doing a md5 hash, and just want to make sure the result of:
md5.ComputeHash(bytePassword);
Is consistent regardless of the server?
e.g. windows 2003/2008 and 32/64 bit etc.
View 4 Replies
Mar 11, 2010
I have a shopping cart. Basically when looking at the product i want to display certain textbox and fields. e.g. if shoes then display the sizes available with qunaityt box against each
what is the best approach for this?
create textboxes dynamically or have static on screen and hide and unhide depending on value
View 4 Replies
Jan 19, 2010
I'm currently using a GridView and I want to set the CssClass for the Row depending on a property of the object that the row is being bound to.I tried the following:
<asp:GridView id="searchResultsGrid" runat="server" AllowPaging="true" PageSize="20" AutoGenerateColumns="false">
<!-- The following line doesn't work because apparently "Code blocks
aren't allowed in this context --> <RowStyle CssClass="<%#IIF(DataBinder.Eval(Container.DataItem,"NeedsAttention","red","") %>
<Columns>
<!--............-->
</Columns>
</asp:GridView>
Now I could simply handle theGridView's RowDataBound event and change the css class of the row there...but I'm trying to keep a clear separation between the UI and the page/business logic layers.
View 1 Replies
Oct 6, 2010
I'm working in an environment where a single web application (running in a web-farm) dynamically connects to different SQL Server databases (possibly on different servers) based on user selection (this part is non-negotiable, unless you can gift me $1,000,000 and/or some kind of time altering device).
I'd like to cache some of the commonly used data from the database(s) in the application, such as "settings", and am looking for a best practice to use with the SqlCacheDependency class or a related database cache dependent solution (not opposed to a custom implementation of SQL notification or polling; notification is preferred over polling).
So far, I'm thinking of using a collection of SqlCacheDependency objects (one for each database) that can be referenced by connection string name or related key. So when the connection is changed to a different database, the cache can be requested/populated by a key of <databasekey>+<datakey> and use the appropriate SqlCacheDependency object (probably handled by a cache-managing wrapper).Or is it just better to take the hit and always go to the database?
View 2 Replies
Jan 27, 2010
My website will target UK and US markets, and i need to display a different price/currency for both markets - what is the best way around this?
1) a simple drop down box asking users preference?
2) Using culture class in asp .net to auto detect eg System.Threading.Thread.CurrentThread.CurrentUICulture
View 2 Replies
Feb 22, 2010
I'm struggling with a web form where I have created one date field and couple of drop down lists. These drop down lists populate themselves from a backend MS ACCESS database file. My problem is that I am not able to make the two drop down menus dependent in a manner that when the first drop down menu is selected the second should be populated accordingly?
This is the code for the website form:
[Code].....
View 3 Replies
May 12, 2010
Im new to learning C# and .Net platform,
I have been wondering how i would go about:
1. Detecting the browser version
2. Using the browser version and associating a class or id for it
3. Using this class or id to be assigned to the html body tag.
Keeping one stylesheet for all browsers but having browser specific styles if any fixes are required. I know this can be done, i just dont know how.
View 6 Replies
Feb 22, 2011
There are two dropdowns in my ASP.NET form. The second dropdown is dependent on the first dropdown - the second onedoes not have the item selected in the first one. My problems is that the selectedValue for the second dropdown is always empty after load event. I tried to set the selectedIndex to be 0 before access selectedValue property in the page load event, but it is still empty. What I want is to get the first item of the second dropdown as the default value.
[Code]....
View 1 Replies
Jan 29, 2011
How to set a iframe with with and height automatically dependen on content
View 2 Replies