.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

dynamic template field order

Posted By:      Posted Date: September 24, 2010    Points: 0   Category :ASP.Net

I have the following example with adds a dynamic template field to my gridview.  However its being added at index = 0.

I need it at the end of the gridview, which has columns determined by user entry, so they will not always be the same amount of columns.

How do I get this template field to be the last column in my gridview.  I have already tried    columns.Insert(index, mycolname) and I get an "out of range" error message


  Protected Sub rtrv_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles rtrv.Click
        Dim bldvw As base, ds As DataTable, dc As DataColumn
 bldvw = New base

        ds = bldvw.bldDynGrd(srCtr.Text, srActiv.Text, srAcct.Text)

        If ds IsNot DBNull.Value Then
            For Each dc In ds.Columns
                Dim bField As New BoundField
                'Initalize the DataField value.

View Complete Post

More Related Resource Links

how to read a custom dynamic data meta data attribute in a field template

All --Please help.I need to know how to read a custom dynamic data meta data attribute in a field template.I know how to do it in a page template because I have a handle to the meta table on the page.However, I do not know how to get a handle to the meta column at run time in a field template.Can you help?Please advise.Thank you.-- Mark Kamoski

ASP.Net Dynamic Data - DropDownList Field Template with AJAX Cascading DropDown Extension

Hi all,   Have spent hours trying to create a Dynamic Data Field Template holding a DropDownList which is extended by the AJAX Cascading DropDown extension. Final form holds multiple cascading dropdown boxes. User selects Country (Land) then Postcodes, Counties (Provincie) are populated. Once postcode is selected then towns (Plaats) are populated.  The problem I am now facing is that the viewstate for the dropdown lists is not being saved/restored after an insert action or custom validation error. So basically the dropdown lists are being reset to their default values. Some code (if missing parts, just ask and I will post them) - Don't mind the code structures etc... needs some refactoring :) Attribute I created:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Data { [AttributeUsage(AttributeTargets.Property | AttributeTargets.Field, AllowMultiple = false)] sealed public class CascadingDropDownParametersAttribute : Attribute { //public string TargetControlID; // The ID of the DropDownList to populate. public string Category; // The name of the category this DropDownList represents. public string PromptText; // Optional text to display before the user has selected a value from the DropDownList. public string

Dynamic Data Field template edits - Tooltip text, Dynamic Data Page template edits - field sort


I have an ASP.net website build in VB 2010 web dev pro using 4.0 framework.  Its a dynamic data site and I am having some trouble formating some of the field and page canned templates.

Q1: Field Templates - the tooltip code (TextBox1.ToolTip = Column.Description) is within the ascx.vp pages for each of the field templates.  Where can I update each columns description (as the code references) so the tooptip will be column/field specific.  If its not as straight forward as that, I was trying to write an if/else statement because the tooltip code is set at the field type level (decimal, date, etc) and I want it to be column specific.  example;

if column.value = Financial Impact

then  TextBox1.ToolTip = "enter financial impact in whole dollars"

else TextBox1.ToolTip = "next fields tooltip text"



Dropdown Event (Template Field)



I have grid view control that includes a dropdown control in a template field.

I wish to execute some code when the value is changed in the dropdown list.  Can't figure out how to capture this event though?

Any suggestions?

dynamic 'Today field' in sharepoint


how to do i get a dynamic 'Today field' in sharepoint?

I found many examples such as this which is completely wrong.  In the example below the [Today] is only calculated on item creation and edit, not every time list item is accessed.
http://blogs.msdn.com/b/sharepointdesigner/archive/2008/08/01/date-functions-in-calculated-fields.aspx .

This is very important my customer wants it done asap.


Thank you.



nothing for members to see

Dynamic query for Null field checking

Hi I want dynamiclly find the table to null values finding.. Please give me quickly   Regards Ram

Dynamic query for datalength field checking

Hi   Please tell me the dynamic query length in table

Dynamic query for Null field checking

Hi I want dynamically check the data Formation query in SQL server please  provide me the query

Set up a validator that compare the value of the current field with an other (using Dynamic Data)

Hi! Most of it is in the title : I'd like have a validator on the DateTime_Edit template for example that allows to compare this field with an other DateTime field. My problem is when I am in the DateTime_Edit template of my "master field" (the one I want to check), how can I access to the other field given the architecture of Dynamic Data FieldTemplates? But perhaps I'm not thinking in a good way on this control. Any advice will be welcome. Thanks Raphaelp

How to modify dropdown document template list order when creating document library?

when creating a new document library, the first template is the one for word 2003. Can we change that to word 2007 one? thanks,

Order by choice field options in order of appearance

I have a list, which has a choice field with a number of options (e.g. Spring, Summer, Autumn, Winter). These options appear in this order in the drop down list, but when I sort the list by this field, the items are sorted alphabetically, is there a way to change it easily, so that the list is ordered by the choice field and the items appear in the same order as the choice options? I am trying to do this programatically using the SPQuery, but any other solution would be welcome too. I am displaying the data using SPGridView control.

Dynamic Data Entity Framework: Initial Sort Order for Views

Hello Steve,I'm trying to set an initial sort order for my View (not table) in Dynamic Data using Entity Framework 2. I have updated my Model and Imported the View. Now I'm trying to use the DisplayColumn attibutebut it's not working.[DisplayColumn("Product", "ParsingOrder", true)]Fabio

Gridview with a linbutton in the template field

hi,i have a gridview as follows,<asp:GridView  runat="server" ID="gvPO"  AutoGenerateColumns="False"   >    <Columns>                    <asp:TemplateField HeaderText="PO No."><ItemTemplate>       <asp:LinkButton ID="lnkPo" runat="server" Text='<%#Eval("Purchase_order_no") %>' ></asp:LinkButton>   </ItemTemplate></asp:TemplateField>              </Columns>   </asp:GridView>The linbutton shows  Purchase_order_no.  When i clicked on a paricular purchase_order_no., it will navigate to another page with a gridview that shows details of that particular Purchase_order_no..... Pls help

Creating dynamic template columns in gridview

how to create dynamic template columns in gridview  . I have writing some of the code but it gives me error The type or namespace name 'GridViewLabelTemplatecould' not be found (are you missing a using directive or an assembly reference?)    I have paste some my code /con.Open();        string strsql = "select ID,CompanyName from tblcompany";               SqlCommand cmd = new SqlCommand();        cmd.CommandType = CommandType.Text;        cmd.CommandText = strsql;        cmd.Connection = con;        SqlDataAdapter adpt = new SqlDataAdapter();        adpt.SelectCommand = cmd;        adpt.Fill(dt);        GridView1.Columns.Clear();        for (int i = 0; i < dt.Columns.Count; i++)        {            TemplateField tf = new TemplateField();            // create the data rows       

Dynamic Fill-in Field

I have a field that is a "Choice" field in which I have put in several names. The name of this field is Candidate 1. I have another field called Candidate Facility 1 in which I made this one a Person / Group field that the user can select a user from our network.Is there a way that I can have that second field "Candidate Facility 1" automatically fill in based on the selection on the first field, "Candidate 1"?Thanks,ChrisChris A

Duplicate field name error, creating new site from custom template

I've made a site that maps the site (with a table of contents) and i export it to another site collection. I'm able to install and activate the solution in the other site collection, however when i'm going to create a new site using the site i've installed as a template it pops an error saying "A duplicate field name Wiki_x0020_Page_x0020_CategoriesTaxHTField" was found." I have no clue what this means. Can anyone help me? Thanks in advance

InfoPath / ActiveX error when using person selector field in Word template off SharePoint document l

I have created an out-of-the-box document library on a SharePoint 2010 site.  I left Microsoft Word Document selected as the Document Template.  I then added a person or group column and a multiple lines of text column to the document library. I then went into Library Settings --> Advanced Settings and clicked on Edit Template, opening the template in Word.  I created my template and added the two new columns to the document.  I did this using the Quick Parts --> Document Property --> [column name] feature under the Insert tab in Word.  I then saved the template back to SharePoint. Upon opening the template or creating a new document from the template, I get the following dialog box: --------------------------- Microsoft Office InfoPath --------------------------- One or more ActiveX controls could not be displayed because either: 1) Your current security settings prohibit running ActiveX controls on this page, or 2) You have blocked a publisher of one of the controls. As a result, the page might not display correctly. --------------------------- OK   --------------------------- I've searched around (I believe fairly extensively) and have not run into anyone else with the same issue.  Some have mentioned a similar error when creating a custom document information panel in InfoPath, and suggested lowered ActiveX security setti
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend