.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

How to create a Custom TextBox Control to provide the custom functionality

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :WPF


I have a requirement that I need to develop a custom textbox control which should support the functionality like:

1. Should display the Default Cursor as Cross Cursor

2. Textbox should be displayed like excel sheet cell (specific to cell) and when user will click the TextBox it should be selected but can not be entered any data inside.

3. Context Menu should be displayed with some information while double clicked on the TextBox but should not be edited the textbox.

4. Context Menu should be displayed if right click on the TextBox

6. TextBox should be on entry mode if user presses any ALPHNUMERIC key from Keyboard.

7. DataValidation should be there when user enters any data.

Can anyone help me on this how to develop such kind of control or May be somebody has already done those things and can give me a hint...

Thanks in advance for the help.



View Complete Post

More Related Resource Links

To create a custom control and type while creating a column


HI All,

i am creating a column in the list while creating a column i will have an option for choice field on selecting choice i can see dropdown, radiobutton, Checkbox to select and  can enter list of values. and on clicking ok i will get a column with radiobutton. in newform.aspx and also in editform.aspx

so i need to create the similar functionality with my custom radio button, so on create column i need to show my custom choce on selecting this i need to show my custom radiobutton  and  can enter list of values then on selecting it then click ok to create a column, in edit form and new form i need to show a radio buttons with values.

Thanks in advance




my custom control flow task's ui failed to create the task...

Hi.. I hope someone else has seen this. The funny thing about the error is it reports on my version 1.0 task but if you hover over the task icon in tool box it clearly indicates I have load my 1.1.1 version from the gac. Thanks=================================== Failed to create the task. (Microsoft Visual Studio) =================================== The task user interface specified by type name 'MergeBuilderTaskUI.MergeBuilderTaskUIMainWnd,Version=,Culture = Neutral,PublicKeyToken = 12345abc6789de01' could not be loaded. (Microsoft.DataTransformationServices.Design) ------------------------------For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%u00ae+Visual+Studio%u00ae+2008&ProdVer=9.0.30729.1&EvtSrc=Microsoft.DataTransformationServices.Design.SR&EvtID=CouldNotLoadTaskUIForType&LinkId=20476 ------------------------------Program Location:    at Microsoft.DataTransformationServices.Design.DtrTaskDesigner.InitializeTaskUI()   at Microsoft.DataTransformationServices.Design.DtrTaskDesigner.OnNewTaskAdded()   at Microsoft.DataTransformationServices.Design.DtsBasePackageDesigner.CreateExecutable(String moniker, IDTSSequence container, String name) =================================== The given assembly name or codebase was invalid. (Exception from HRESULT: 0x80131047) (mscorlib) ------------------------------Program Location:    at System.Run

How to create custom security groups to control different custom activities?



How to create  custom security groups to control different  custom activities?

Thanks and Regards,

Swati Jain

Can I only create session on login and redirect to login from other apps if not using custom provide


I have created custom a MembershipProvider, SessionIDManager, and SessionStateStore since I need to use custom legacy sessions and logins.. When the Application is ran, it runs the GetSessionID in the SessionIDManager(which is correct)..

The problem then is if there is no session meaning the GetSessionID method returns null, it tries to create a new session using CreateSessionID.. I want it to redirect to the login application(another application)..

We only create and store session information for logged in users and the "session id numbers" come from a file that is pre-populated with "session id numbers"(I didnt design this and its out of my control).. So its not feasable to give everyone who visits the site one of the "session id" numbers..

I also need for users with an "invalid" session(when checked through Validate()) to be redirected to the login page..


Any help here would be great..

How to create custom control in .net which can retrive data from sharepoint list and redirect to sit


Hi help me!

I am strugling this problem!

My requirement is I need to create a custom control which need to retrive data from sharepoint list, The list contain some sites information like Title, url, Scope my requirement is i need to display sites Title in my custom control and when i click on title (site name) in custom control it need to be redirect to that site and whenever list data updated automaticaly custom control data also need to be apdated automatically .

client side functionality in a custom server control using vb?



is it posible to add client side functionality to a custom server control in vb.net?

i am looking at msdn library and there is no code for vb :/ http://msdn.microsoft.com/en-us/library/aa719700%28v=VS.71%29.aspx

I fount this on MSDN Library Adding Client Capabilities to a Web Server Control

What i'm trying to do is to add some client functionality to my control, so that you can get or set some properties/values on client side. From the above link i see  that this is doable with Ajax Server Control, but i don't have it, i have Custom Server Control. Can i do this with Custom Server Control and how?

Thank you.

How to implement add/remove functionality in Custom Control


Hi, I am new to CustomControl and need some help to understand it. I am trying to create a custom control derived from Control class. This control will have two collelction (FromItems and ToItems). Now I have to move item from one collection to other after selecting it(kind of picklist control). I have created dependency properties for both item sources and selctedItems in the collections. I am thinking to bind these sources and selcted items in Style. Can you anyone suggest, how to implement the add and remove behavior from the itemSources? I feel this behaviou should be part of control as this is a fix behaviour. I tried to create some routed event but not sure how to raise it. I am planning to style this as Two list boxes and two buttons(to add and remove from destination list). Is it a correct approach? How to proceed?


Create simple Custom Control step by step


Hello everybody!

I know, there is a possibility to extend a currently existing control, but I would like to see how to create a simple custom control in wpf.

The custom control has three properties:

- Value as a bool

- ColorOn as Color and

- ColorOff as a Color

The control is a reactangle or circle. It should be possible to set the two colors and bind a bool variable to the Value property. If the variable == false, the reactangle should to have the ColorOff as background and if == true - ColorOn. How to do this? I would like simply to understand it.

There are many examples allready, but none of them could solve this issue. Many of them ware too complicated for the start. I'm newbe in wpf, but I can see allready the boundless possibilities of it!

Greets - Raphael

How can I create a custom control that adds other controls visible to the page hosting my custom con


I want to create a custom control where I define several specifically named DIV sections.  The code-behind logic of the custom control will perform operations on these named DIV sections.  The page where the custom control is hosted needs to be able to add named controls to the DIV sections and perform operations on these named controls added to the DIV sections.

Let me explain a little further.  In the custom control, I want to have code behind logic that fires the following Page Event and uses a condition to make one or another specifically named DIV section visible or not:

    < _
    ToolboxData("<{0}:BaseDetails runat=""server""></{0}:BaseDetails>") _
    > _
    Public Class BaseDetails
        Inherits UserControl

        Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreRender
            DetailsNameDiv1.Visible = False
            DetailsNameDiv2.Visible = False

How to Create Events in Custom Control


I have Created one Paging control, in which i want to create PageIndexChanged Event, please help me to create that ecent and also want to call that event asp.net page

How to get javascript 'value' property for custom textbox control


I created one custom control which contains TextBox as a child control (and contains some other controls? also). After this I placed this control in a Page and I'm trying to get TextBox value(i.e text) through javascript. But I'm unable to get 'value' property directly.

Custom Control code:????

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

namespace AjaxServerControlDevelopment
    public class MyTextBox: CompositeControl
        /// <summary>
        /// TextBox reference variable
        /// </summary>
        public TextBox objTextBox;

        /// <summary>
        /// The TextChanged event
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event EventHandler TextChanged;

        /// <summary>
        /// The ButtonClick event
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event EventHandler<EventArgs> ButtonClick;

            #region Class constructors

        /// <summary>
        /// Default constructor

How to create LinkButtons in a custom control so they post back



I've created a custom control whereby I have a number of Panels (defined by the user) stored in a collection.  When rendered, I need each Panel to render a LinkButton with a CommandArgument.

When I try this, there are two problems:

  1. The LinkButton simply renders as a normal <a></a> on the page, with no javascript added to cause the postback
  2. Because of the above, no postback occurs so I can't even test whether the CommandArgument is getting posted back!

Can anyone help me out?  I've Google this and found lots of similar posts but with no answer.

Here's my render code which currently isn't doing what it should...


Protected Overrides Sub Render(ByVal writer As HtmlTextWriter)
	If MyPanelsCollection IsNot Nothing AndAlso MyPanelsCollection.Count > 0 Then
		For Each p As Panel In MyPanelsCollection
			Dim lb As New LinkButton
			lb.CommandArgument = MyPanelsCollection.IndexOf(p).ToString
			AddHandler lb.Command, AddressOf LinkButtonCommandSub
			lb.Text = "Link " & MyPanelsCollection.Indexof(p).toString ' text set to Link 0, Link 1 etc'
	End If
End Sub


create custom application page with a ribbon and user control webpart


i am in stress how to start this what should be the first step

i want to create custom application page with a ribbon and some user
control web part to show document item properties.

Please help me regarding this


thanks in advance 



wasikhan junior software ENG

Need to know about the kind(button, textbox, list or combo) of .NET control after custom based seria



In the process of serializing .NET control object to custom object( sayMyControlObject) to the other process for some purpose , I need to re-draw these controls in custom manner. For that I need to know what type it is like ( its is button, textbox, combo box, TextField, Calander, ToolStrip,TtoolstripMenu,RichTextBox,TabControl or TreeView it is). For that I might need sort of typeOf(RichTextBox) == RichTextBox sort of check.

I will be very obliged and thankfull , if any body having idea about this?

Regards Usman

Need to know about the kind(button, textbox, list or combo) of .NET control after custom based seria



In the process of serializing .NET control object to custom object( sayMyControlObject) to the other process for some purpose , I need to re-draw these controls in custom manner. For that I need to know what type it is like ( its is button, textbox, combo box, TextField, Calander, ToolStrip,TtoolstripMenu,RichTextBox,TabControl or TreeView it is). For that I might need sort of typeOf(RichTextBox) == RichTextBox sort of check.

I will be very obliged and thankfull , if any body having idea about this?

Regards Usman

Custom Editing Behavior for DataGridView TextBox Columns

For various reasons I'm using a DataGridView instead of a ListView, and while configuring the DataGridView to look like a ListView wasn't much of a problem, there's one thing that got on my nerves, which is the behavior of textbox cells in edit mode: It is much too easy to leave the edit mode accidentally, simply by pressing the cursor keys at the wrong time. For example when the text caret is positioned behind the last character of the textbox cell content, and you press the right arrow key

how to get an array of all the asp.net textbox control inside create user wizard control?



How can I get all the textboxes inside a create user wizard control using getElementsByTagName().

Below is my JQuery code:

<script type="text/javascript">
        function addLoadEvent(func) {
            var oldonload = window.onload;
            if (typeof window.onload != 'function') {
                window.onload = func;
            } else {
                window.onload = function() {

        function prepareInputsForHints() {
            var inputs = document.getElementsByTagName("asp:TextBox");
            for (var i = 0; i < inputs.length; i++) {
                inputs[i].onfocus = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "inline";
                inputs[i].onblur = function() {
                    this.parentNode.getElementsByTagName("span")[0].style.display = "none";



<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
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