.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

validate control A depending on if control B has any value (diff types)

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :ASP.Net
I've ready everything I can find on the built-in validators but can't figure out how to do the sort of validation I need on the client-side (I can do it on the server-side).  Business rule I want to enforce (review the gridview snippet below) is if user checks the CheckBox_EditLifeCycleRpt control but doesn't enter a value in the TextBox_LifeExpectancy control then the validation should fail.  <asp:TemplateField HeaderText="Life Expect*" SortExpression="LifeExpectancy"> <EditItemTemplate> <asp:TextBox ID="TextBox_LifeExpectancy" runat="server" Text='<%# Bind("LifeExpectancy") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="Label_LifeExpectancy" runat="server" Text='<%# Bind("LifeExpectancy") %>'></asp:Label> </ItemTemplate> <ControlStyle Width="50px" /> </asp:TemplateField> <asp:TemplateField HeaderText="Life Cycle Rpt" SortExpression="LifeCycleRpt"> <EditItemTemplate> <asp:CheckBox ID="CheckBox_EditLifeCycleRpt" runat="server" Checked='<%# Bind("LifeCycleRpt") %>' /> </EditItemTemplate&g

View Complete Post

More Related Resource Links

Problem in Custom Control Unable to find Control To Validate Property


I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'


My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

Validate a People Picker control

Hi,I would like to validate a People Editor field. I have tried using the property Allow Empty, but unfortunatly it doesnt work. I have used a Required field validator. Luckily it works to some extent. But the problem starts if there is any postback happening on the page. After the postback, it takes the value to be empty even if there is an entry in the control.Could anyone help me if there is any perticular property to be enabled or any other solution to acheive the validations on People Editor Control Raj

validate sharepoint datetime control

Hi   i am using sharepoint datetime control. i need to validate  user entering past date. (should not allow).   <asp:CompareValidator ID="Comparevalidator1" runat="server" ErrorMessage="The date must be greater than today"                                     ControlToValidate="dtExpiryDate" Operator="LessThanEqual" Type="date" ValueToCompare='<%# DateTime.Now.ToShortDateString() %>' />   The above code throwing error.   Rgds, Vinay

validate sharepoint datetime control

Hi   i am using sharepoint datetime control. i need to validate  user entering past date. (should not allow).   <asp:CompareValidator ID="Comparevalidator1" runat="server" ErrorMessage="The date must be greater than today"                                     ControlToValidate="dtExpiryDate" Operator="LessThanEqual" Type="date" ValueToCompare='<%# DateTime.Now.ToShortDateString() %>' />   The above code throwing error.   Rgds, Vinay

Using HTML5 new input types with .NET TextBox control


Hi here's my problem.


I'm building a iPhone, iPad website I'd like to use the new HTML 5 input types: http://www.w3.org/TR/html-markup/input.number.html so a numeric keyboard will pop.


I'm using a ASP .NET TextBox :

<asp:TextBox ID

How to validate the Sharepoint's InputFormTextBox control

validating the Sharepoint's rich text box control.

SSIS Version Control - Can the Smart Diff feature of the BIDS Helper VS add-in be activated without


Specifically, my question relates to the requirement of the Smart Diff feature of the BIDS Helper VS add-in, namely, that it can be activated only if the client is VSS or TFS Source Control. If one had Visual Source Safe installed on one's system, but did not use it to manage SSIS Packages, i.e., the latter are not Checked-In to VSS, can the Smart Diff feature be operable?

Sharepoint 2010 Custom Field Types & Field Properties ( Editor Control )



I've been searching this forum and all over the web for a working example of how to implement a Editor Control with a Sharepoint 2010 custom field type.

The only documentation on MSDN mentions the implementation of IFieldEditor. There are no propper examples of how to implement properties on custom field types.

All I could find on MSDN regarding this issue was :



Has anyone done anything simmilar and know of a propper example of how to implement it?



Pieter Theron | http://www.pietertheron.co.za


Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

Accessing the different controls inside a GridView control

how we can access a particular control which resides inside a GridView control. In this article I will show you how you can access different controls inside a GridView control. We will see how we can access a TextBox control, a DropDownList control and a ListBox control. If you are working with ASP.NET 1.X then you might want to check out my article Accessing Different Controls Inside a DataGrid.

In-Depth look at the GridView Control

In the last article we looked at few of the new controls available in Asp.net 2.0. We also talked about Grid View Control which has replaced the Asp.net 1.1 DataGrid control for good. In this article we will examine more features of the Grid View control. In this article we will see some of the common operations that can be performed using the GridView control. Apart from these operations there are many more functions that can be performed on the control and which we will see in the later articles

ASP.NET repeater control - databind with style

even used the inline editing features, which I at the time thought was the coolest way possible to write ASP.NET code ( I managed to write code to hide all other rows and only show the current one - the row being edited). With a nice looking EditTemplate it looked indeed very slick but it really turned into giant and hard to manage code behind files.

Creating Paging for a Repeater Control

A common question is "How do I implement paging within a Repeater?" Although the beauty of the Repeater control is its flexibility, you're on your own for building most functions. ASP.NET 2.0 has included some new controls that provide paging, as does the DataGrid in ASP.NET 1.1. However, this tip shows you how to roll your own paging for a simple data viewer.

Using TemplateFields in the GridView Control

The GridView is composed of a set of fields that indicate what properties from the DataSource are to be included in the rendered output along with how the data will be displayed. The simplest field type is the BoundField, which displays a data value as text. Other field types display the data using alternate HTML elements. The CheckBoxField, for example, renders as a checkbox whose checked state depends on the value of a specified data field; the ImageField renders an image whose image source is based upon a specified data field. Hyperlinks and buttons whose state depends on an underlying data field value can be rendered using the HyperLinkField and ButtonField field types.

How To Add calendar control inside a GridView

This article show hot to add calendar control inside a GridView with code in c#

Using ATLAS PopUp Control with Calendar inside the GridView Control

In this video tutorial Mohammad demonstrates how you can access the Calendar control which is displayed using the ATLAS PopUp control inside the GridView control.

GridView control to show master-child or master-slave data, written in c#, asp.net

I previously made a master slave datagrid using Visual Studio 2003 .Net (original article) that would allow users to show data to clients using collapse and expand features. These features however did not carry over to gridview for many users. This tutorial will explaing how to create a collapsable/expandable gridview in frameworks 2.0 and higher
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend