Making asp:CheckBoxList Items Side By Side - c#

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>

Related

Deleting Selected ListViewItems from the Database

I have a ListView that I populate from the database. The ListView has a Checkbox on each row which is a built-in property of ListView.
I have been trying to get the text from the ID column next to the Checkbox which I will use in deleting the respective rows from the database but it all fails. I thought I could get the ListView.CheckedIndices and use them in return to point to the SelectedText of each index.
However all fails. More specifically i wanted to use the OnItemDeleting Event of list view but the ListView I have does not seem to have such event.
Is there any way i can achieve this?
I have had this problem before. What I did was this below:
<asp:ListView ID="xyz" runat="server">
<ItemTemplate>
<asp:LinkButton runat="server" ID="blah" OnClick="blah_Click"
CommandArgument="<%# myObject.Id %>" />
</ItemTemplate>
</asp:ListView>
I got the passed id through the command argument.Then I deleted the selected item and refreshed the data for listView. I am sure there must be a cleaner way of doing it.
Let me know how it goes.

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.

change radiobuttonlist repeatdirection="horizontal" to vertical if mobile

I have a webpage which contains radiobuttonlists. I would like to change the radibuttonlist repeatdirection from horizontal to vertical. I am using CSS Skeleton framework. So my page is responsive but asp:RadioButtonList doesnt change.
here is my code
<asp:RadioButtonList ID="rbl_payment_type" runat="server" RepeatDirection="Horizontal" AutoPostBack="true" OnSelectedIndexChanged="rbl_payment_type_SelectedIndexChanged">
<asp:ListItem Value="0">Serbest Ödeme</asp:ListItem>
<asp:ListItem Value="1">Ön Tanımlı Ödeme</asp:ListItem>
</asp:RadioButtonList>
how do I change it repeat direction for responsive html?
You might want to look into the RadioButtonList's RepeatLayout property, which determines if the radio button list is rendered as a table or not. Also, if you are using .NET 4.0 or later, then you have the option for a ordered list or unordered list.
Here is the documentation for RadioButtonList RepeatLayout property
Once you have it in a non-table layout, then I believe it will be more conducive to CSS for a responsive UI.

how to make the dropdownlist in edit mode

<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

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.

Categories

Resources