How to create a Dropdown button in asp.net c#? - c#

Does anyone know the name of the property in which it look alike button
but once if we keep the mouse pointer
on it then it will show like dropdown
list options.
I want to use that in my asp.net
project.

There is no out of the box control as such. It is an effect achieved either using javascript or CSS
Take a look at this example
http://demos.9lessons.info/DropMenu/MyDemo.html
You should also search for jquery plugins for this. Though you will get readymade code for it but it will surely not be a server side control. You have choice of either creating a user control or just use it as it is.

unfortunately there is no such control out of the box in asp.net. you might want to look at third party controls or do some css magic.

Something like that maybe a standart one(1) .But I can recommend you to use telerik if you are using it already here is a example (2)
Example2
Example2

Related

Create a nice user input in a popup and send the data to the main page

I am working on an ASP.NET/C# application,
I am looking for the best way to do the following. (Note: I don't need you to tell me how to do it, just if you can point me to the right direction to look)
in my main page I have a button. When the user clicks it,I want to open popup open containing a map. the user can click on counties to highlight them and then click on submit. I want to be able to know which countries the user has clicked on in my main page (maybe save it in a array or string or anything)
What is the best way to do this? Should I use flash?
I know this is not a problem/solution type of question, but if someone can point me in the right direction I would very much appreciate it. Just some ideas and I will do the researches.
Thank you very much for any inputs or comments
And sorry for not being a specific problem question.
For the pop-up you can use a dialog (a "modal" HTML form like what you find in jQuery UI or similar). If you're using plain "old" ASP.NET you may need some trick if you want to use forms but they works well.
If what you want to provide is a selection from a map you do not need Flash (at least I wouldn't use it for such simple task, I'm not a fun of that kind of extensions). An image map can work well and it's more portable. If you want you may use HTML5 features to provide better experience for users with a compatible browser. I do not remember the link but I saw a very nice example of this using plain HTML (4) and JavaScript. Using a low-res image as base for the map, small images as checks applied on top of it and div tooltips for details (it supported a zoom-on-click feature too to enlarge a portion of the map loading a higher resolution version). I guess I wrote somewhere that URL...
Links
Nice article: http://www.workwithchoicecuts.com/methodology/revisiting-the-html-image-map/
For image maps basics: http://www.javascriptkit.com/howto/imagemap.shtml
Image map builder: http://www.image-maps.com/
jQuery plug-in for selection from maps: https://github.com/jquery/plugins.jquery.com

Can you make a "separator" in ASP.net Textboxes? (C#)

I was just curious if it's possible to put a "separator" (Not sure what you'd call it) in a textbox in ASP.net. For example, I want a textbox on my form to be a blank textbox with "blank:blank:blank" so they can just type the time, and another to be "blank/blank/blank" for the date, and so on. I've tried googling it for a bit but didn't find what I was looking for, probably because I'm calling it a seperator, and I'm not sure how accurate that is. I was hoping it could be done that way, but if there's another way, I'm using C#. Let me know if I explained that right at all or if you can recommend anything. As before, I appreciate the help from this community!
Probably should start with checking out if an input mask meets your needs. The AJAX Control Toolkit might be a good place to start when looking at easy to use controls. Check out their MaskedEdit control at: http://www.asp.net/ajaxlibrary/AjaxControlToolkitSampleSite/
Use the MaskedEdit control in ASP.NET (from the AJAX Control Toolkit), should do exactly what you want.
HOW TO Use the MaskedEdit Control in ASP.NET

Windows Forms control that behaves like the ASP.NET Ajax AutoComplete extender?

Successfully using the AJAX Control Toolkit AutoComplete extender, I'm looking for a Windows Forms 2.0 control that behaves similar to it:
Since I want to use the control to enter multiple e-mail receivers, my primary requirement is to have multiple, independent items to auto-complete.
I.e. this cannot be done by the standard auto complete feature of a TextBox control which only supports auto-completing one string.
In other words, I'm looking for something similar than Outlook's e-mail text box (but not as advanced, just the auto-complete part, no underlining required):
Even after searching Google (and Bing) for quite a long time I manage to have no luck in finding such a control.
My question:
Is there some example out there on how to build such a control, or even a finished control to use?
Since the application should be very slim, I do not want to use 3rd party libraries like DevExpress or Telerik or Infragistics.
Update 2014-12-24:
The commercial DevExpress library now has a Token Edit Control that might just be the control I was looking for:
You might take a look at the IAutoComplete interface. That will let you create a class that you can use instead of the standard auto-complete for an edit box. In that class you would handle what part of the string you are auto-completing on and the source of where the data is coming from.
http://msdn.microsoft.com/en-us/library/bb776292(v=VS.85).aspx

How to build a Windows Forms email-aware text box?

I'm building a C# client app that allows a user to communicate with one or more existing users in a system via an email-like metaphor. I'd like to present the user with a text entry box that auto-completes on known email addresses, and allows multiple delimiter-separated addresses to be entered. Ideally, I'd also like the email addresses to turn into structured controls once they've been entered and recognized. Basically, I'm modeling the UI interaction for adding users after Facebook's model.
Are there any Windows Forms controls out there with the ability to do something like this? Is there any well-established terminology for a hybrid textbox / control list box (no, not a ComboBox) or something that I should be searching for?
Thanks,
-Patrick
I have had good luck in the past creating composite user-controls to provide specific functionality using native .NET Winforms controls. It works pretty good as long as there aren't too many of them, in which case things start to slow down.
In you case, and this is just off the top of my head, but, perhaps you could take a FlowLayoutPanel, a Button, and a Textbox which supports auto-complete and put these together to create a control that would provide the functionality you are looking for.
If there are no addresses selected in the control (e.g. in a List<string>), then the container (FlowLayoutPanel) would only display the TextBox. Once the user selected an entry, the control would automatically create a Button with the appropriate caption and insert it to the left in the FlowLayoutPanel. If the user removes an address he/she has already selected, simply remove its representation (the button) from the FlowLayoutPanel, and the TextBox can resize accordingly. There may be issues with getting the TextBox to fill up the remaining space (I can't remember how to do that), but you get the idea. The container does not have to be FlowLayoutPanel - you could use a Panel with Docked controls, or even a TableLayoutPanel for this.
A design as I described would allow the user to delete the address by clicking on the button. However, without some other visual cues, that isn't very intuitive or user-friendly, so I would consider making the "Button" be another composite control which contains a "prettied-up" label along with an tiny delete Button (X) to the right. For this you could use a Panel control and dock the X button to the right, and fill the Label on the left. You would provide public properties here as needed to control the text and provide an event handler or callback for the delete functionality.
Once the visual stuff is working, all that is left is to provide the appropriate Properties and Methods on the main control to allow it to interact as needed with outside code.
As a simple, "poor man's", implementation you could take a look at the AutoComplete* properties of the TextBox control. You could dynamically populate the AutoCompleteSource with your known addresses and when an entry matches, add to a separate, list-style control of your choice.
See this SO article for some interesting code snippets related to your question, and my suggested workaround.
Beyond the built-in AUtoComplete properties you're probably looking at having to purchase a 3rd party control from a tools vendor.
I've not seen anything like that before in WinForms. In WPF it would be another matter - if you can use that, maybe consider hosting a WPF control within your WinForms application instead?
I think you're trying to do something similar to this codeproject article: AutoComplete TextBox
And since you mention WPF in a comment, you also have this article: WPF AutoComplete Folder TextBox (should be easy enough to cut out the folder bit of the article I'd thought).
Well, there isn't such a control. If I were you, I'd create 2 textboxes to do the job. See, a normal textbox can easily be configured for autocomplete from a list, even dynamically; however, it accepts only one entry at a time.
So, I suggest you dedicate one textbox for autocomplete, and one for the addresses. So, whenever there is a qualified email address in the first textbox, and you click enter, the address gets added to the address textbox, and automatically add delimitation.
Then you need to handle the addresses in the address textbox as objects instead of characters. Code it in a way that when a user tries to delete a character in an address, the whole address is deleted.
This is the workaround I can think of. I'll help with the code if you give it a try.

How do I add HTML links in C# TextBox?

How can I put a link in a C# TextBox? I have tried to put HTML tags in the box but instead of showing a link it shows the entire HTML tag. Can this be done with a TextBox?
Use the RichTextBox, no need to build your own, it cames with VS
I would try using an editable div and making it look like a text box. This would allow you to get user input and use links.
To make this easier, try JEditable.
If that is in windows forms and you really can't use the richtextbox, you can create a control with a linklabel inside of textbox.
http://www.codeproject.com/KB/miscctrl/LinkTextBox.aspx
I would think about this a little bit. If you allow executable code in an editable control, the user, the user can execute ANY code. This is generally a bad idea.
The behavior of the C# control is intentional to prevent the exact behavior that you are trying to create. A little creativity (such as parsing out links from the text box and creating a list of links next or below the text box) will provide a much safer application.
To my knowledge not with the standard textbox. You'd have to create your own. One option it the Telerik controls, they're a little pricey for individual development, but very robust and configurable.
For windows application, we can use a webbrowser control. However, for web applications Freetextbox will do the job.This is freely available dll.

Categories