Put a dropdown arrow in RadAutoCompleteBox of Telerik - c#

Is it possible to place a dropdown arrow in RadAutocomplete textbox, so that user can see what options are the list? Please see the screen shot
<telerik:RadAutoCompleteBox
id="Variants"
runat="server"
skin="Silk" EmptyMessage="Type here" DropDownPosition="Static" DropDownHeight="200px">

The Telerik doco states it's not possible to browse the items in the dropdown area when using a RadAutoCompleteBox.
See here: http://www.telerik.com/help/aspnet-ajax/autocompletebox-difference-with-combobox.html
I prefer using a regular RadComboBox with the following attributes e.g.
<telerik:RadComboBox runat="server" ID="ddlVariants" AppendDataBoundItems="True" EmptyMessage="Type or select a variant" MarkFirstMatch="True" AllowCustomText="True" Width="200px" CheckBoxes="True" />
This approach still allows multiple selection and dynamic filtering of items, with the ability to expand the items to manually search if required.

Related

Telerik radlistbox datakey does not transfer

I have two Telerik radListBoxes (source and destination). Both are databound with their DataKeyField and DataTextField values set. The destination listbox may have some values in it from a prior session.
When I transfer an item from the source listbox to the destination listbox using the built in buttons, I can see the value (text) is transferred over, but the datakey for that item is null.
I'm new to these controls, and everything is working well, except for this.
<telerik:RadListBox runat="server" ID="rlAvailableTitles" Height="200px" Width="300px" ButtonSettings-AreaWidth="35px"
AllowTransfer="true" TransferToID="rlTitles" SelectionMode="Multiple" AppendDataBoundItems="true"
AllowTransferOnDoubleClick="true" DataKeyField="TitleID" DataTextField="TitleName" CssClass="text-align: left;" AutoPostBackOnTransfer="true">
</telerik:RadListBox>
<telerik:RadListBox runat="server" ID="rlTitles" Height="200px" Width="300px" ButtonSettings-AreaWidth="35px"
AllowTransfer="true" TransferToID="rlAvailableTitles" SelectionMode="Multiple" AppendDataBoundItems="true"
AllowTransferOnDoubleClick="true" DataKeyField="TitleID" DataTextField="TitleName">
</telerik:RadListBox>
And after they click on 'save':
foreach (RadListBoxItem item in rlTitles.Items)
{
string myTitleID = item.DataKey;
// etc...
}
What am I missing to get the datakey that is stored with the item in the source listbox?
DataKey has no setter.
Use DataValueField instead.
I found the solution to this particular problem. I added DataValueField="TitleID" to the source radListBox in the aspx file. Then in my code behind, the value that I'm looking for in the destination radListBox is available in item.Value. Seems pretty straight forward in retrospect.

dynamically add child list-view items in radio-button-list

There is this asp.net radio-button-list which have three list view items.
<asp:RadioButtonList ID="rdbFolderOptions" runat="server" RepeatDirection="Vertical"
RepeatLayout="Flow" Font-Size="Medium" AutoPostBack="true" OnSelectedIndexChanged="rdbFolderOptions_SelectedIndexChanged">
<asp:ListItem Text="Calendar" Value="0" />
<asp:ListItem Text="Tasks" Value="1" />
<asp:ListItem Text="Contacts" Value="2" />
</asp:RadioButtonList>
on click of any of the options, there should be a child list that should come that have fix options.
<asp:RadioButtonList ID="rdbSubFolder" runat="server" RepeatDirection="Vertical"
RepeatLayout="Flow" Font-Size="Medium" AutoPostBack="true" OnSelectedIndexChanged="rdbSubFolder_SelectedIndexChanged">
<asp:ListItem Text="Editor" Value="0" />
<asp:ListItem Text="Reviewer" Value="1" />
</asp:RadioButtonList>
for example :
If you have selected "calendar" than a child list should come under "calendar" indented like below.
Calendar
Editor
Reviewer
Tasks
Contacts
I am comfortable it doing with javascript/jquery/c# but not able to figure out how to ident it. Working code will be helpfull.
Update :
Check this:
How to create a treeview with radio buttons in the [grand]child nodes?
I think you are looking for TreeView Control
The TreeView Web server control is used to display hierarchical data, such as a table of contents or file directory, in a tree structure. It supports the following features:
Automatic data binding, which allows the nodes of the control to be bound to hierarchical data, such as an XML document.
Site navigation support through integration with the SiteMapDataSource control.
Node text that can be displayed as either selectable text or hyperlinks.
Customizable appearance through themes, user-defined images, and styles.
Programmatic access to the TreeView object model, which allows you to dynamically create trees, populate nodes, set properties, and so on.
Node population through client-side callbacks to the server (on supported browsers).
The ability to display a check box next to each node.

asp.net ListView sort by column

I have a list view binded to a data source.
How can I enable sorting by column?
So when clicking the column title once it sorts by ascending, click it again it sorts by descending.
Is there anything in the wizard that can be setup or it all needs to be done programatically?
If you are using a data source control then sorting can be implemented in the ListView control without having to write a single line of code - it is all handled automatically by the ListView and its data source control. Of course, in more advanced scenarios we may need to manually sort the data or programmatically.
In the following example, ListView will be sorted by ProductName and UnitPrice. simply add two LinkButtons in the ListView's LayoutTemplate with appropriate CommandName and CommandArgument property values.
<asp:ListView ID="ProductList" runat="server" DataSourceID="ProductDataSource">
<LayoutTemplate>
<h3>Product Listing</h3>
<asp:LinkButton runat="server" ID="SortByName" CommandName="Sort"
CommandArgument="ProductName">Sort by Name</asp:LinkButton>
| <asp:LinkButton runat="server" ID="SortByPrice" CommandName="Sort"
CommandArgument="UnitPrice">Sort by Price</asp:LinkButton>
<blockquote>
<asp:PlaceHolder runat="server" ID="itemPlaceholder"></asp:PlaceHolder>
</blockquote>
</LayoutTemplate>
...
</asp:ListView>
If a user clicks the "Sort by Price" link twice in a row, the first time the products will be sorted in ascending order (from cheapest to most expensive), but the second time the sort order will reverse.
That depends on the DataSource you are using. If the Data Source allows sorting, it can be set up in the way described here http://msdn.microsoft.com/en-us/library/sa88ktts.aspx . Otherwise you have to handle sorting yourself programatically. Usually that is even easier than the automatical approach.

Looking for suitable DataBound control to implement questions page

I looking forward to find a suitable asp.net DataBound control (C#) to implement in my application.
I wanted to create a exam page where each page show 10 questions, each question got a Label control and a radiobutton control to display the choices, the data to be bind into the DataBound control might be having multiple rows where each rows represent each question.
I found that DetailView control was quite suit with my requirement but I not able to set the page size.
Please help to give some suggestion and advises, thank you in advanced.
I would use a DataList or a ListView, because it will allow you to enter a template for each item. The reason I would choose these over a repeater is because you can use data keys, which will probably come in handy.
Here's a simple example of how you could implement a list of questions:
<asp:DataList ID="DataList1" runat="server" DataKeyField="QuestionID" ...>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Question")%>' />
<asp:RadioButton ID="RadioButton1" runat="server" Text="Yes" GroupName="QuestionAnswer" ... />
<asp:RadioButton ID="RadioButton2" runat="server" Text="No" GroupName="QuestionAnswer" ... />
</ItemTemplate>
</asp:DataList>
I would recommend to you to use the Repeater control since you can customize it's design very easily to suit your needs.
Here are two tutorials on how to use it:
http://www.w3schools.com/aspnet/aspnet_repeater.asp
http://www.learn-asp.net/asptutorials/Repeater.aspx
Update:
Repeater doesn't have pagination included so you would have to add it:
http://blog.divergencehosting.com/2009/03/25/adding-paging-repeater/
Other option would be to just use a GridView which has pagination included.

Insert and Edit Template show in Devexpress in aspxGridview

In Insert Mode I want to show one kind of Template and Edit Mode I want to show another Kind of Template in Devexpress Control in C#.NET
This can be implemented using the following approach:
You should define the EditFormTemplate so that it contains a different set of editors for the Insert and Edit functionality. Handle the HtmlRowCreated event to hide non required editors based on the ASPxGridView's IsNewRowEditing property value.
Check out the sample project on this issue which demonstrates the solution based on user controls and binding expressions. In this solution, the EditForm template contains two user controls with the Visible property bound to the ASPxGridView.IsNewRowEditing property:
[HTML]
<uc1:Edit id="Edit1" runat="server" Visible="<%# !Container.Grid.IsNewRowEditing %>"></uc1:Edit>
<uc2:Insert id="Insert1" runat="server" Visible="<%# Container.Grid.IsNewRowEditing %>"></uc2:Insert>
Btw, this issue might also be helpful. If you need more help, please contact the DevExpress support team here.
Use an ASP template field and individual item templates inside your gridview
<asp:TemplateField id="test" runat="server">
<ItemTemplate>
<ItemTemplate>
test
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox Text="test" runat="server"/>
</EditItemTemplate>
</ItemTemplate>
</asp:TemplateField>
I did the above from memory. Heres a link to an example i found as well:
http://programming.top54u.com/post/ASP-Net-GridView-Edit-ItemTemplate-Mode.aspx

Categories