.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

DropDownList Binding - Ways to Increase Speed?

Posted By:      Posted Date: October 20, 2010    Points: 0   Category :ASP.Net

I have a gridview that displays query results on a reporting page for a "home-grown" CRM application. From the gridview, a link can be clicked which opens a modal window that contains an iframe linked to a "details" page where record specific info can be viewed/altered. On the details page there are 10 or so dropdownlists (ddls) that are bound every time the page is called. The ddls are bound using a method similar to the example below. I am looking for a way top speed things up a bit. The details page could be called 10-20 times in one session and every time the page loads these ddls have to be bound from the same methods but for different records. What are some options for speeding up the load time for this page??

if (!Page.IsPostBack)
     //call initial processes
     //and a few more method calls for binding ddls....

private void GetModel()
        string connString = ConfigurationManager.ConnectionStrings["processes"].ConnectionString;
        string cmdString = "SELECT Model, Type + '§' + CAST(ID AS NVARCHAR) + '§' + Factory AS Vals FROM Machines WHERE (Active = 'True')" +
                           "ORDER BY Mod

View Complete Post

More Related Resource Links

Data Binding to Dropdownlist


   private void AddDBDataToControl(DataSet app_Support,int count)
        int i = 0;
        while (count != 0)

            DateTime dt = Convert.ToDateTime(app_Support.Tables[0].Rows[i]["FromDate"].ToString());

//dt=23/08/2010 10:04:00 AM

            DropDownList h1 = (DropDownList)GVDate.Rows[i].Cells[1].FindControl("txthour");
            h1.SelectedValue = dt.Hour.ToString();
            DropDownList m1 = (DropDownList)GVDate.Rows[i].Cells[2].FindControl("txtmin");
            m1.SelectedValue = dt.Minute.ToString();

            DropDownList h2 = (DropDownList)GVDate.Rows[i].Cells[5].FindControl("txthourto");
            DateTime dt2 = Convert.ToDateTime(app_Support.Tables[0].Rows[i]["To

Problem Binding DropdownList in a gridView to a datasource

I have a Dropdownlist in an itemTemplate in a gridview. My gridView binds to dataTable1 (from which the selected value for dropdown comes from) and dropDown binds to dataTable2 (i need to get DataValueField and DataTextField from here).<asp:TemplateField HeaderText="Category"> <ItemTemplate> <asp:DropDownList ID="Cat" runat="server" SelectedValue='<%#Bind("CATEGORY") %>' > </asp:DropDownList> </ItemTemplate> <FooterStyle BorderStyle="None" /> <HeaderStyle BorderStyle="None" /> <ItemStyle BorderStyle="None" /> </asp:TemplateField>How do I do that? thanks in advance!

Problem binding data to DropDownList in DetailsView

Hi guys. I have a slight issue I awas trying to fix for 2-3 days, but nothing I try works. The scenario: DetailsView control in edit mode, I pass parameters to the SqlDataSourceProducts (edit.aspx?id=2) and the data source selects the appropriate data and fills in the DetailsView form. Except two drop down lists. These two DDLs (DDL2 and DDL3) are dependent on the previous DDL (DDL1) in the DetailsView. Thanks to PeteNet, when the selected value of the DDL1 changes, DDL2 and 3 change their lists and get bound to the database. The problem is: when I edit something from the database, DDL2 and 3 appear empty and when I update any other field and leave these, they get blanked in the database.  My goal is to set the selected value of DDL2 and 3 to the values in the database WHERE ID = QueryStringField="id". I can go for not binding the data unless the field is changed, but does not sound professional and user friendly. code: The SqlDataSource used to select the parameters from the table and populate the DetailsView <asp:SqlDataSource ID="SqlDataSourceProduct" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT ID, wm_number, upc, check_digit, unit, price_unit, brand, category, shelves, type, cooking, storage, packaging, origin, nutriti

Binding dropdownlist along with Heading


I need to bind a dropdownlist to multiple column along with the column heading.. the heading should be unselectable

something similar to this

Each group are in differnet tables..

How can i implement this

its consuming my time.. thanx in advance...

binding dropdownlist to datasource C#


 I have the following code in which I am trying to use a dropdownlist to update values in a gridview. I having trouble getting the datasource to bind to the dropdownlist

here is my code:

protected void GridView2_RowDataBound(object sender, GridViewRowEventArgs e)
                if (e.Row.RowState == DataControlRowState.Edit)
                    DropDownList DropDownList1 = new DropDownList();
                    string Query = "SELECT DISTINCT STATUS FROM VW_MSG_VIEW";
                    DataSet dt = new DataSet();
                    OracleCommand cmd1 = new OracleCommand(Query, con);
                    OracleDataAdapter sqlDa = new OracleDataAdapter(cmd1);
                    DropDownList ddl = (DropDownList)e.Row.FindControl("DropDownList1");
                    ddl.DataSource = dt;
                    ddl.DataValueField = "STATUS";
                    ddl.DataTextField = "STATUS";

I am getting nullreference exception on line ddl.DataSource = dt;


Thanks for any help

binding xml to dropdownlist declaratively


i have xml file like this.


<?xml version="1.0" encoding="utf-8" ?>
    <Name>My State 1</Name>
    <Name>My State 2</Name>
      <Name>My State 3</Name>
      <Name>My State 4</Name>
      <Name>My State 5</Name>

and an aspx file


<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
  <head runat="server">
    <form id="form1" runat="server">

Model Binding with DropDownList


Hello again -

I seem to be having issues with posting forms with DropDownLists. I've looked all over the net and tried various solutions, but none seem to work for me.

I'm getting the following error: The parameter conversion from type 'System.String' to type 'Models.Organization' failed because no type converter can convert between these types.

Here's my ViewModel:

    Public Class RegistrationViewModel
        Public Property User() As User
                Return _user
            End Get
            Set(ByVal value As User)
                _user = value
            End Set
        End Property
        Private _user As User

        Public Property ConfirmPassword() As String
                Return _confirmPassword
            End Get
            Set(ByVal value As String)
                _confirmPassword = value
            End Set
        End Property
        Private _confirmPassword As String

        Public Property Profile() As Profile
                Return _profile
            End Get
            Set(ByVal value As Profile)
                _profile = value
            End Set
        End Property
        Private _profile As Profile

        Public Property PhoneNumber() As PhoneNumber
                Return _phoneNumber

Update Panel - Speed: Question on how to increase speed



Does the use of update panels increase the speed of a website?

A code sample:

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
<asp:Panel ID="Panel1" runat="server" HorizontalAlign="Left" Wrap="False" ScrollBars="Vertical" style="position: relative">
<asp:Label ID="LabelClock" runat="server" Text="Label"></asp:Label>
<asp:Literal ID="Literal1" runat="server"></asp:Literal>



<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">

<asp:Panel ID="Panel2" runat="server">
<asp:Label ID="LabelNumber" runat="server" Text="Label"></asp:Label>



LabelClock.Text is set at every postback in the page load event, to the current time. But the UpdatePanel1 is only updated when the con

2 simple ways to configure WCF binding

Binding in Windows Communication Foundation defines that how to communicate with a WCF Service?

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Six easy ways to customize your site using Web Parts in SharePoint

Becoming familiar with Web Part customization techniques gives you a range of page-customization choices. For example, you can customize your site's home page so that it displays the specific information that your team needs. You can rearrange the list items on the home page, add lists, and even change the images on the home page. As you become more familiar with Web Part Page customization techniques, you can build interactive Web Part Pages that makes the data in lists more dynamic and useful, and you can add new Web Parts that provide access to external data and Web services.

Binding the multiple drop down boxes in GridView using JQuery in ASP.NET

Here is the code for binding the multiple drop down boxes in GridView using JQuery in ASP.NET

jQuery: Styling DropDownList Alternating Items (Rows)

In the following example, I will show how you can style any asp:dropdownlist very easily.

The example demonstrates how you can change alternating row items background color, using the fadeTo() to add a nice touch in the dropdownlist. You can change alt rows with a couple lines.

Binding WPF Controls to an Entity Data Model

In this interview, programming writer, McLean Schofield, demonstrates how to bind WPF controls to an entity data model, using Visual Studio 2010 Beta 1. You can also learn more in the topic: Walkthrough: Binding WPF Controls to an Entity Data Model.

Working with DropDownList and ListBox Controls in ASP.NET

"In my application i am using dropdownlist to display all categories from a table. When the user clicks this control I display all records in that category. Category table also contains column called color.

I wanted display some categories in dropdown list different color and others in different color using ASP.NET."-Anonymous

ASP.NET DropDownList Web Control, Part 1

Anybody with much experience in ASP has written an include file function for populating the contents of a SELECT dropdown list with entries from a database. Some of the more advanced users have even gone so far as to add caching to their function to reduce database hits for these rarely changing menu options. Naturally, these same techniques are going to be used with ASP.NET, but with a new programming object model. ASP.NET provides a web control, the DropDownList, which can be used for the same purposes as our custom built SELECT tag from Classic ASP.

Declaring a DropDownList in ASP .Net

A DropDownList is also commonly known as combo box. It can contain multiple data members, but unlike a normal list box the users can choose only one value from this control. Though the functionality of this DropDownList is much like a Single Row Select List Box, a DropDownList can save a lot of GUI space as it is rendered on a Single line and is expanded only when the user clicks on the Control
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