Dynamically Creating Bound and Template Columns in GridView
2007-01-04 09:22
579 查看
Dynamically Creating Bound and Template Columns in GridView | ||
By AzamSharp | ||
Introduction: There are situations when you need the columns to be created dynamically. Creating dynamic columns in GridView control is almost identical to Datagrid control. If you are working with Datagrid control than check out my article Creating Dynamic Bound and Template Columns in Datagrid Control. In this article we will see how to create dynamic bound and template columns for the GridView. Dynamically Creating BoundColumn for GridView: BoundColumns are pretty straight forward. Check out the code below:
Dynamically Creating a Template Column: Now let's see how we can create template columns dynamically. Since template columns can contains any control you must define a custom template which creates the controls that are identified. You can download the template file which is present in the zip file at the end of this article. The code below shows how you can use the custom template "GridViewTemplate.cs".
Since I am using SqlDataSource object it will take care of binding for me but if you are using a different data source than you must call GridView1.DataBind() method to bind it on the screen. Please view GridViewTemplate.cs file which contains the main code to create the template columns. I hope you liked the article, happy coding! | ||
By AzamSharp |
相关文章推荐
- Dynamically creating bound and template columns in GridView using ASP.Net
- Dynamically Creating Bound and Template Columns in GridView
- Creating and deleting threads dynamically in eCos
- Dynamically Adding Template columns to a GridView
- Creating, Stopping, Re-Starting and Deleting a Timer in Oracle Forms
- Creating and Using Your Own Delegates in Objective-C
- Creating DataGrid Templated Columns Dynamically - Part I
- [Angular] Bind async requests in your Angular template with the async pipe and the "as" keyword
- Class method differences in Python: bound, unbound and static
- SCSF - Part 8 Creating and Using Services in the CAB
- Creating your first Web Service provider and consumer in LotusScript and Java.
- Reusing Code in C++: inheriting and template
- Replace Template and delete the tables in the drawing
- Javascript Module pattern template. Shows a class with a constructor and public/private methods/properties. Also shows compatibility with CommonJS(eg Node.JS) and AMD (eg requireJS) as well as in a br
- [Angular 2] Generate and Render Angular 2 Template Elements in a Component
- Creating DataGrid Templated Columns Dynamically -
- creating-skeletal-animation-in-blender-and-exporting-it-to-three-js
- sharepoint ECMA using a list template to creating a list in SubSIte
- Creating Emotion in Games: The Craft and Art of Emotioneering
- django1.8 提示(1_8.W001) The standalone TEMPLATE_* settings were deprecated in Django 1.8 and the TEMPLATES dictionary takes precedence. You must put the values of the following settings into your defau