how to make the dropdownlist in edit mode - c#

<asp:DropDownList ID="ddlReportFavorite" runat="server" Height="16px"
Width="190px">
</asp:DropDownList>
I need to have the dropdownlist to be editable, that is when a user wants to type, it allows to type. Thanks.
EDIT
Is there any method using javascript or any other alternative without going for Ajax Control Toolkit. Thanks.

You can use a bootstrap select picker and add extra attributes to your asp:dropdownlist such as the following:
<asp:DropDownList ID="ddlEditStatusCode"
runat="server"
CssClass="form-control selectpicker"
data-live-search="true"
data-size="10">
</asp:DropDownList>
You also need to add bootstrap-select.css and bootstrap-select.js to your web page.
The result should be like this:

Have a look at the ajax control toolkit, in particular...
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/ComboBox/ComboBox.aspx
and a decent tutorial here
http://www.asp.net/web-forms/tutorials/ajax-control-toolkit/combobox/how-do-i-use-the-combobox-control-cs

Just have a look at jQuery Searchable DropDown Plugin
jQuery Searchable DropDown Plugin Demo

Related

Making asp:CheckBoxList Items Side By Side

I have a problem and i couldn't find the solution on web. I'm using asp CheckBoxList but i have too many data to list. I want to list items like in 2 column in box area. I'm sharing an image. Please check it out. So how can i do something like that?
The important thing is; this checkboxlist filling dynamically from code behind. I dont have ListItem on html page. So i cant style them. Any idea?
<asp:CheckBoxList ID="AreaCheckBoxes" runat=server>
</asp:CheckBoxList>
You can set the RepeatColumns property to 2 and the RepeatLayout property to Table.
<asp:CheckBoxList ID="AreaCheckBoxes"
RepeatColumns="2"
RepeatLayout="Table"
RepeatDirection="Vertical"
runat=server>
</asp:CheckBoxList>

enabling search option in combobox

<asp:ComboBox ID="ddlfrom" runat="server"
DataTextField="name" DataValueField="name" MaxLength="0"
style="display: inline;"
AutoCompleteMode="SuggestAppend">
</asp:ComboBox>
this is the asp code for my combobox...i am populating my combobox from database.I have all the city names in my combobox.Now i have enabled suggest append as you can see..but its not searching the elemnts anywhere from the names..mean when i type "SBC" code it searches for bangalore city..but i need that when i type "bang" in this also it should show me bangalore city..the same functionality as we have in makemytrip site..how can i do that..??..plzz help..
You are asking for autocomplete feature.
See this link.
You can do it using the jQuery.ajax functions. This Article explains how you can do it.

ASP.Net repeator, click and go to respective record on next page.How?

i worked in PHP before and used to use window.location function with javascript function, please let me know how to tackle the functionality in repeator,
record 1
record 2
record 3
I want if some one clicks on a label, it should go to other page, page.aspx?id=1 or id=7 respectively
I dont want to use javascript window.location, is there any built in asp.net option in repeater to do so, i have passed postback url to page.aspx.
Thanks
Atif
Drop a DataPager in your page and set it's PagedControlID attribute to your repeater's ID
<asp:Repeater ID="Repeater1" runat="server">
</asp:Repeater>
<asp:DataPager ID="DataPager1" PagedControlID="Repeater1" PageSize="5" runat="server">
</asp:DataPager>
Update:
Apparently DataPager doesn't like Repeater, so I suggest using ListView instead. In the end ListView is very much like Repeater but more flexible.

How can i bind data to a dropdown in the gridview which is an EditItemTemplate

I declared my template as follows
<EditItemTemplate>
<asp:DropDownList ID="ddlYear" runat="server" DataSource='<%#GetYears() %>' DataTextField="year" DataValueField="year"></asp:DropDownList>
</EditItemTemplate>
I need to bind the data from the function i used GetYears() i don't know how to function it can any one help me
I need the data for example name to be loaded in dropdown when i click on Edit of gridview is it the correct way or is there any best way to do this
in the code behind you can find dropdown using findcontrol method on the click of edit link and can bind easily.
You could create an objectDatasource on the page and then set the datasourceid to that objectDataSource. Then you can create your POCO class
Look at this link for more info on objectdatasource
http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/objectdatasource.aspx

Can I use my beloved Calendar Extender in MVC?

I love the calendar extender, but I am unable to use it in my MVC app. How do I connect the calendar extender to a textbox in MVC... or add the extender at all for that matter?
Old Way...
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
...
<asp:TextBox ID="txtDate1" runat="server" ValidationGroup="DateCheck">
</asp:TextBox>
...
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
...
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate1">
</cc1:CalendarExtender>
Yes you can - if you use the Microsoft Ajax libraries. Link here. Calandar code here.
If you go to Stephen Walthers bolg - here I'm sure there's an example of using the server side controls if memory serves me correctly.
Why not use the JQuery UI datepicker?
See JQuery UI DatePicker
You have to setup your view like a web form, or use a web form within the MVC application, as it requires a form with runat server and a scriptmanager on the view page.
I found the solution. A pretty helpful step by step link that gave me EXACTLY what I want...CodeSprouts.com helped me out alot. Thanks for the directions!!!

Categories

Resources