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.
Related
I have a dropdown in ASP.net webforms, I want to create a another dropdown based on first level selection.
Say, 1.Furniture
2.Electronics -> i.TV
ii.Mobile
Is it possible to do like above only by using asp tag or adding second level like TV and Mobile in C# code.
`<asp:DropDownList ID="ddlCategory" runat="server" Width="200px">
<asp:ListItem Text="Select Category" Value="0"></asp:ListItem>
<asp:ListItem Text="Furniture" Value="1"></asp:ListItem>
<asp:ListItem Text="Electronics" Value="2"></asp:ListItem>
</asp:DropDownList>`
Note: I don't want to display it dynamically even though it is preferable.
Please help me in this problem
You can use Bootstrap 3.0.0 dropdown menu
Visit this link
Click Here
I'm have ASP MultiView for an application form. Inside one of the view I have few radio button as follows--
<div class="row">
<asp:CustomValidator ID="Group1Validator" GroupName="Group1" runat="server"
ValidationGroup="Group1" Display="Dynamic"></asp:CustomValidator>
<asp:RadioButton ID="Group1Yes" runat="server" GroupName="Group1" Text="Yes"/>
<asp:RadioButton ID="Group1No" runat="server" GroupName="Group1" Text="No" />
</div>
Now on the code behind I want to iterate through all the RadioButtons in that page and pull the values to be saved in the DB. I have tried the solution HERE both Loop and LINQ version, but the problem is my RadioButton controls are not directly in the page. Let me elaborate-
First, I have multi view in a page-
Multi view contains views-
And finally inside views I have the RadioButton controls-
Now my goal is the fetch the values of all the RadioButton that are selected which is laid out using the div above.
Any help and guidance will be much appreciated! Thanks!
You must put your RadioButtons as childs of RadioButtonList, then iterate in foreach loop over RadioButtonList items.
Why not use a RadioButtonList
<asp:RadioButtonList ID="RadioButtonList1" runat="server">
<asp:ListItem Text="Yes" Value="1"></asp:ListItem>
<asp:ListItem Text="No" Value="0"></asp:ListItem>
</asp:RadioButtonList>
And then you can get the value in code behind
string value = RadioButtonList1.SelectedValue;
You can also add items to the RadioButtonList in code behind
RadioButtonList1.Items.Insert(0, new ListItem("Yes", "1", true));
RadioButtonList1.Items.Insert(1, new ListItem("No", "0", true));
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.
I have been adding UpdatePanels to my application around the objects that I just want to update.
Example, When I click a button I want a ListBox to update. I would wrap the UpdatePanel around the list box in the html, but when I do this my design goes all over the place.
I am not sure If I'm using AJAX the correct way, as I have seen people adding Triggers but don't know how and where to use them, here is an example of my code:
<asp:ListBox ID="lst_AdminExistingDepartments" runat="server" >
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
<asp:ListItem Text="Acceptance"></asp:ListItem>
</asp:ListBox>
</div>
<div class="AddEditUpdateDepartment">
<asp:Label ID="lbl_AdminAddEditUpdateDepartments" runat="server" Text="Modify Departments" />
<asp:Label ID="lbl_AdminAddDepartment" runat="server" Text="Add Department" />
<input id="txt_AddDepartment" runat="server" type="text" class="aclass" />
<input id="btn_AddDepartment" runat="server" type="button" class="ButtonAdminPage" value="Add" onserverclick="btn_AddDepartment_ServerClick" />
Here is a ListBox and also a Textbox and a Button. When they click that Button I would want the ListBox to update with the record entered in the TextBox using AJAX?
At the most basic level you need to place the UpdatePanel around all controls being affected by the action. So you need the List, TextBox and Button all inside the UpdatePanel.
Following on from that you have more advanced scenarios where you can have Triggers and multiple UpdatePanels etc. However, it would be best to start with something simple (i.e. everything you need in one UpdatePanel and advance from there.
So I am using a Repeater inside a form to display a list of questions that are retrieved from a database.
Each Question allows the end user to select Yes or No and add some additional Text like this.
<ItemTemplate>
<asp:Panel runat="server">
<asp:RadioButtonList RepeatDirection="Horizontal" CssClass="YesNo" ID="YesNo" runat="server">
<asp:ListItem Value="Yes" Text="Yes" />
<asp:ListItem Value="No" Text="No" />
</asp:RadioButtonList>
</asp:panel>
<asp:Panel runat="server" CssClass="MoreInfo">
<asp:TextBox ID="TextBox1" TextMode="MultiLine" Height="70px" Rows="10" Columns="25" Wrap="true" runat="server" CssClass="MoreInfoText"></asp:TextBox>
</asp:Panel>
</ItemTemplate>
The repeater is databound to a datatable in the PageLoad event.
One on the fields in the datatable is the Question's number.
So when the data is posted how can I tell which question # each answer (Yes or No and additional Text) is refering to?
If I were generating the HTML by hand instead of using a Server Control I could just make the name of the html element that will be posting data like
name=variableHoldingQuestionNumber + YesNo
name=variableHoldingQuestionNumber + AdditionalComments
But I can't seem to use a variable when setting the Name attribute inside a Repeater Item.
Is abandoning the Server Control and writing the HTML myself my only solution.
Bind the questions number to a hidden field and when the save comes back, grab that hidden field back off and take the number out of it. Then you know which question you are looking at.
Put a break point on page load and do a postback. Take a deep look at Request.Form key/value pair collection. Everything from the post will be in there, with predictable labels/indexs.