.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

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

Posted By:      Posted Date: September 10, 2010    Points: 0   Category :ASP.Net
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

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

Ajax Cascading Dropdown - no data



I have been trying to get started with Ajax Toolkit and have started with the Cascading Dropdowns. I am following this tutorial: http://www.nerdliness.com/article/2008/02/15/using-asp-net-ajax-cascadingdropdown-visual-basic-and-database

But I cannot my dropdown lists to populate with any data. The only difference from the tutorial code is that I am connecting to different tables (but I have tested each query to make sure it returns data).

I have no idea where to start trying to fix this issue. Any help is appreciated

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?

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

Create dynamic dropdown list when we export data to excel using SSRS.


Hi All,

I have assigned a work to create a report, that should render in excel with dropdown list. i.e. report should contain a input parameter as a table names, when user selects the table name, report should show only the field names of the selected table. Some of the field name have look up values that values should be displayed as dropdown when we export to excel.

Can any one have any idea how to proceed with this report?



dynamic template field order


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.

display only the date (not time) from a sqlserver date field in dynamic data


I have some Date fields defined in my sqlserver database but these display with a time part as well (00:00:00).

how do i esnure that only the date part is displayed and not this redundant time?


Help with opening PDF from SQL05 Database from AJAX cascading DropDown



I am new to ASP.NET and AJAX. I have recently viewed the video tutorials on the Cascading Dropdowns, and applied that to my website. I am populating the dropdowns from 3 tables, and am wondering how i would be able to open pdf file from the sql database and display it in the browser. Can anyone provide me any suggestions? Thanks to all

Ajax cascading dropdown and passing querystring to webservice



i am using Cascading dropdown, with following scenario.

a page "myPage.aspx" is loaded with a Querystring. [http://localhost/myVD/myPage.aspx?jobID=003]

this page contains 2 cascading dropdowns say state & City .  the idea is to fill the provinces Combo based on INCOMING querystring value "jobid".

also i have a webservice named "Mywebservice.asmx" which has webmethods to retrieve city based on jobID.

but since these webmethods are Contained in asmx . the querystring of the caller page is not visible to the webmetod of the service.

here's  snippet for reference/

public CascadingDropDownNameValue[] GetContainerByJobID(string knownCategoryValues, string category
            //StringDictionary categoryValues = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
            //string jobId  = categoryValues["JobID"];

           string  jobId

assign default value to dynamic data field



I have the script below and I want to apply a default value to the DynamicField StudentId (please see line in bold) below. Can anyone tell me how to do so?




        <asp:GridView ID="GridViewGuardians"  runat="server" SelectedIndex="1"
            AutoGenerateColumns="false" DataKeyNames="StudentGuardianId" DataSourceID="LinqDataSourceGuardians" ShowHeader="true" ShowFooter="True">
                   <asp:LinkButton  ID="lbInsertGuardianG" runat="server" CommandName="Insert" ValidateionGroup="addValidationGuardian" OnClick="lbInsertGuardianG_Click" >Insert</asp:LinkButton>

How to access the data item(current row) in the field template control?



     How to access the data item(current row) in the field template control? 

Data Form Web Part - Sharepoint Dropdown List as a field in Edit View - Possible?


Hi guys,

I'm building a Sharepoint page with a data form web part that uses custom SELECT and UPDATE statements with an SQL Server connection in order to retrieve and store records of information.

I'm getting along fine, records seem to update how they should etc, but I've ran into a problem with one thing: Sharepoint dropdownlists in 'Edit Template'

So the issue is this: if I replace a textbox field with a dropdown list that is populated with a separate SQL datasource, the dropdown list seems to be unable to show the current value of the field.

E.g. I have a dataview which has a field "FruitID", which I can update just fine by setting the ID value to different numbers. The SQL datasource uses the FruitID to display a list of all available Fruits, (e.g. 1 = Banana, 2 = Apple, 3 = Cherry, etc).

If i open the dataview in editmode, the default value in the dropdown is null, despite the real value of the field being "2", which should show "Apple" in the dropdown.

I can select a fruit and click save, and it will update just fine. But the initial display needs to show the correct value to start with.

Is there a custom binding I should be coding to make this work? I can't configure dropdown <items> on an individual level as they are populated from the SQL server. I can't set "SelectedI

Cascading Dropdowns with Dynamic Data


Hi there,

 I need to disable a dropdown depending on the selected value of another dropdown in my detailsview in edit mode.

 I had previoulsy created a file enumeration_edit.ascx so that I would be able to bind a list of names to this dropdown but now that we have a new type of user I want to disable this dropdown when a different user type is selected.

I was thinking of adding a simple 'if' statment when binding the list to the dropdown but I'm not sure how to get the other dropdown's selected value from inside enumeration_edit.ascx.


Appreciate some feedback.

how to get dropdown list data VALUE FIELD property in JavaScript



im getting  'ON' as value instead of its actual value

Dynamic Data and Ajax Control ToolKit


How can you make the Ajax Control ToolKit's controls to work in an ASP.Net Dynamic Data web site?

ASP.NET: AJAX Cascading Dropdownlist with Autosuggest using Jquery

This article explains with an example on how to implement cascading dropdownlist using jquery and apply autocomplete feature using Select2 jquery plugin in the client side.
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