[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Validating  custom control

Posted on 2008-06-24
5
Medium Priority
?
808 Views
Last Modified: 2012-08-14
Hi,
1) I am developing a custom control containing textboxes. I want to use required field, reg expression and compare validation controls to check  custom control's textbox inputs.
2)Also when i will use custom control in .aspx web page. It will use validation summary control of the .aspx web page to display validation error message.
Please help me out in this case    
Cheers
0
Comment
Question by:Manusmrati
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 12

Expert Comment

by:madhevan_pillai
ID: 21854190
Hi

try this. go thru ValidationProperty("Text")]


using System.Collections.Generic;
using System.ComponentModel;
using System.Text;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;


[DefaultProperty("Text"), ToolboxData("<{0}:Textvalidator runat=server></{0}:Textvalidator>"), ValidationProperty("Text")]
public class Textvalidator : WebControl, INamingContainer
{
   
    TextBox t;
    Button b;
    protected override void OnInit(EventArgs e)
    {
        t = new TextBox();
        b = new Button();
        this.Controls.Add(t);
        this.Controls.Add(b);
    }
   
    [Bindable(true), Category("Appearance"), DefaultValue(""), Localizable(true)]
    public string Text {

        get { return t.Text; }
       
        set { t.Text = value; }
    }
   
}
0
 

Author Comment

by:Manusmrati
ID: 21854398
Hi

Thanks for your reply, Actually Its a Common fields Address custom control with textboxes and labels. I have a provision to diable textboxes and lable at run time, So you can custamize it according to your need.Till that time, i am rendering the textboxes using override render method. I am not creating an instance of the textbox which you used in your above mentioned code. Is there a way i can add client side validation using embedded javascript file.  I think if you rendering a control , client side validation is the best solution.
Or
I would go for creating a instance of the texboxes and label and individually go for ValidationPropertyAttribute check .
Suggestions are welcomed.
Cheers

need your view point.
Cheers
0
 
LVL 12

Accepted Solution

by:
madhevan_pillai earned 1000 total points
ID: 21855424
Instance method is the best one. You can directly bind  the custom control to validation controls.

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question