ASP.Net Image Dropdownlist using Repeater

I was searching for ASP.Net Image Dropdownlist that can have a image thumbnail before the text in each item in the list. However, we do not have any option ASP.Net Image Dropdownlist that can contain image thumbnails. WPF does but not ASP.Net. Hence, I started planning to build one for my project. However, it is not a user control or server control. This can be made as server control with necessary changes but this article will be big. I would like to keep it simple and to explain how this can be achieved.

Constructing the Image Dropdownlist

 I was interested in showing this as close as possible to the standard Dropdownlist. I planned to have three main components to construct. The following are the list and hierarchy of the controls used

• Dropdownlist as a HTML DIV
a. Image to show the selected item’s Image
b. Label to show the selected item’s text
c. Button to s ...

Read more here:   Asp.Net Image Dropdownlist 

How to build a Horizontal List using an ASP.net Repeater

Have you ever tried generating a horizontal list in ASP.Net?  There is no control in ASP.Net which natively supports this (to my knowledge).  Radio button list supports the list’s orientation as horizontal. But you can not use radio button list for a menu. I am trying to use a repeater to fabricate the menu so that you can add the other onClick events later to bind to the respective actions.

Why ASP.Net over the other data controls.

ASP.net repeater is a very simple control which just repeats the items defined in the ItemTemplate. It does not add anything other than this. This gives us more possibilities in generating the code as we like. And for this menu we don’t need any paging or runtime sorting options. So with a little CSS and JavaScript we are ready to use the horizontal menu we created.

Bind the Data

Please refer to the data controls section for how to connect the data and ...

ListView and Templates

ListView is a fantastic control when you want to render the tabular data in a customized way. It gives you a lot of templates to work with. These templates will improve the most used functionalities. This article explains about one of them, which is ListView GroupTemplate.

What is not covered?

The basic functionalities of ListView and how to bind the data to DataSource from SQL database are not covered in this article. Please refer to the ASP.Net Data Controls section for that.

LayoutTemplate

This template is used mainly for determining the basic layout the control supposed to render. So in our case this will hold the groups. Further groups hold their respective items. Hence we need to specify the GroupPlaceholderID to the layout template not to the GroupTemplate.  I have placed a silver colored (as a background) box to contain all group boxes.

ListView GroupTemplate

As I already mentioned in the previous ...

Read more here:   ASP.net ListView GroupTemplate 

A Customized DataList Paging

If you ever worked in GridView, you will be amazed with the native functionalities that GridView offers. But DataList is not loaded with that many features. It is basically meant for binding data in a tabular format.  If there is a need of sorting, paging then we need to write our own code to cater those needs.

Note:
1) As it is already explained in earlier articles several times, I am not going to explain again how to get the data and how to bind the data from database. So please refer to the Asp.net DataControls section or GridView section for that matter

2) This sample is written to explain how to rollout a paging support for DataList. It may not suit your real-time situation as it is.  You may need to code to make it better for real time situations.

Limitations on DataList Paging

1) There is no native paging support for the DataList.
2) There is no DataPager support, (those ...

Read more here:   ASP .Net DataList Paging 

GridView inside a ListView

ListView is a very flexible control for rendering custom formatted outputs. I have already managed it to get a horizontal menu with liquid layout. Its fantastic set of templates allows most of the rendering to be easily done. With a little bit of CSS knowledge we can avoid rendering tables for most of the lists. It is not only flexible in rendering, but also very good in handling controls inside its template. To explain this i have placed a GridView inside ItemTemplate to load in all cells.

Asp.net ListView ItemDataBound to load GridView

For explaining the usage of listview ItemDataBound, I have chosen a GridView to be placed in a template (fetched using findcontrol). So based on the ListView‘s values the GridView will be populated. As usual, I have taken Northwind as a sample db. Further Category and products tables are selected for ListView and GridView respectively. Initially categories will be loaded into the ListView, and then P ...

Read more here:   Asp.net ListView ItemDataBound 

DataBind GridView with Entities and LINQ

A simple article for understanding LINQ with Entities for data binding a GridView. While the main objective is not about the GridView data binding, the goal is to find how we can use the LINQ effectively along with Entities to bind data. Why I have not decided not to use DataTable with LINQ to bind is, because I would like to stay away from SQL queries completely.

Adding ADO.NET Entity Data Model

As we planned to go for entity based approach, the model has to be created. To be simpler I always prefer to work with Northwind Database. This time we select the Category table for our sample.
1) Right Click the website and add new Item
2) Select the Categories as Data in the left side pane
3) Select the ADO.NET Entity Data Model.
4) Name the Model appropriately and click Add.

Configuring the Created Entity Model

As we know the Data model has to be configured along ...

Asp .Net Listview Checkbox DataBinding

To display list data, we can use several controls like ListView, DataList, Repeater, GridView, DropDownList, etc... Since we have a variety of controls to choose from, the control can be selected based on the requirements. If it is a single column single selection, then DropDownList is the right choice. If paging, sorting, and editing is required then GridView is the right choice.  There is no built in Paging support for listview. So we need to use DataPager to get paging support.

GridView like DataBinding

As we bind the data in the GridView, we can easily do in ListView also. There is not much difference in terms of binding data. But one important information to be noted is to have a ItemPlaceHolder. By default the name of the Item Place Holder is itemPlaceholder. ASP.Net allows it to be ...

ListView Paging Asp.net

To display list data, we can use several controls like Repeater, GridView, Dropdownlist, etc... Since we have a variety of controls to choose from, the control can be selected based on the requirements like if it is a single column single selection the Dropdownlist is the right choice. If paging, sorting, edit is required then GridView is the right choice. 

No native paging support for ListView

The paging support is not available in the ListView out of the box. So you can not just enable the paging as we do in the GridView natively. Since the ListView and repeater are bit advanced controls, they are having a good control in rendering. To repeate items based on a designed pattern, we can use itemPlaceholder in the Layout Template. Then what ever in the ItemTemplate will be replaced the itemPlaceholder in the layout template. Likewise we can use ...

Asp.net Repeater Example

To display list data, we can use several controls like Repeater, GridView, Dropdownlist, etc... Since we have a variety of controls to choose from, the control can be selected based on the requirements like if it is a single column single selection the Dropdownlist is the right choice. If paging, sorting, edit is required then GridView is the right choice. 

But repeater allows listing data which can be flowed based on the way it is designed. It can be used to list the data horizontally or vertically. And can be formed as a table or can be formed as a HTML List (li). For displaying tabular data still we can use the repeater to form the HTML Table. However when the repeater is used as a container for controls we can always design the templates such a way that result can be rendered with <div> s and <li> s.

Templates in Repeater

There are few templates that will be much helpful in repeater. If you ever worke ...

TreeView DataBinding in Asp.Net

I liked DataBinding much when I have upgraded from Classic VB to Asp.Net. Treeview Asp.net Selectednode can be used to fetch the respective node. Especially on DataGrid (No GridView in 1.0, 1.1), DropDownList, etc... When ever I see a control in Asp.Net more are less it can be bound to various source basically a Datatable and Array list.

The first time I disappointed is to bind a TreeView to a relational data. I thought I can get some support for at least self referenced table. But practically TreeView does not accept any flat DataSource. That means it accepts only HierarchicalDataSource.

TreeView DataBinding Procedure

1) Fetch the database tables to DataTable
2) Find the relation between the tables
3) Establish the relation with DataRelation.
4) Mark the relation as nested
5) Mark all columns mapping as at ...


Spam Bot Trap



   



Select Theme
White
Blue
Brown
Gray