.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 in the FooterTemplate of a DataGrid will not show its items

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

I am placing a dropdown list in the footer of a DataGrid like this:

<asp:DataGrid id="MyGrid" runat="server">
            <asp:DropDownList ID="myDDL" OnLoad="myDDL_OnLoad" runat="server" />

In my code behind file, in the myDDL_OnLoad event handler, I call to the database, populate a SqlDataReader, and set the DDL's datasource to that datareader. I define what data columns should be used for the DataValueField and DataTextField of the dropdownlist. Then I call the DropDownList's DataBind() method. Everything works without error. But, when the dropdownlist is displayed, it has blank lines in it.

By that, I mean if 8 records are loaded into the dropdownlist, it will expand to a size appropriate for 8 rows but, it will be empty. there is no text in it.

Has anyone seen this type of behavior before? This dropdownlist is in the footer of a dynamically loaded ajax update panel so, it is difficult to see the source code to see what values are in the html element rendered to represent the dropdown.

Thanks in advance for any advice you can give.

View Complete Post

More Related Resource Links

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.

Multiple Column Dropdownlist for the ASP.NET DataGrid

Based on my previous control "Multiple Column DropDownList for ASP.NET", I received many emails asking for the same control to be used in the DataGrid for web applications. Here we go.. This control can be used as the regular MS DropDownList in the DataGrid and also as a regular dropdownlist. It has all the properties, like DataTextField, DataValueField, DataSource, SelectedIndex etc. The download file contains the samples both in VB.NET and C#. In this sample, I have used the Northwind database of SQL Server.

How to handle Active and inactive items in the dropdownlist?


It is a general ASP.NET questions. Many times some items in dropdownlist will become inactive (retired)or active again. It is easy to handle in the new records which use only currently active items. But how to handle the inactive items which need to be used to show history records. It bothered me a long time, not sure how to solve this problem efficiently.


dropdownlist javascript change items


I can't find solution for this problem for very long time:

I have dropdownlists in Gridview. I need to dinamicly change content of dropdown on client with javascript. Ok, I know to do that. But the problem is when I send data to server changes in dropdownlist does not see. On server I have  old items. How can I change items in dropdown on client with javascript and than see that items on sever when postback data?


dropdownlist bound to sqldatasource adds items instead of replacing on change



I have a series of dropdownlists on webform in ASP 4.0. The first drop down is filled upon load, and then when a user selects a value from that list, it populates the second dropdown. To accomplish this, I have a SQLdatasource with a parametersource of the first drop-down list control. This works great, except when a user changes their selection from the first drop down. It performs the query, but then adds the list of items to the ones that were already there from the previous selection, instead of replacing it with the new data. Here is the code:

 <asp:DropDownList ID="ddlMajor" runat="server" DataMember="DefaultView" 
      DataSourceID="SqlDataSource1" DataTextField="majortext" 
      DataValueField="majorkey" AppendDataBoundItems="True" AutoPostBack="True">
         <asp:ListItem Value="0">Select Major</asp:ListItem>
<asp:DropDownList ID="ddlReq" runat="server" DataMember="DefaultView" 
      DataSourceID="SqlDataSource2" DataTextField="req" DataValueField="admreqkey" 
            AppendDataBoundItems="True" AutoPostBack="True">
                <asp:ListItem Value="0">Sel

Show/hide dashboard items Sharepoint



I'm having a problem with trying to filter the appearence of items on a sharepoint site by having a dropdown list and filter according to the current value, The method i am using atm is by having javascript and by looping through all the <td> on page. This works for list views, But not for Performance point dashboard objects/web parts, +

Is there a way to somehow get the title of all performance point objects on a page, fill the dropdownbox show/hide depending on the selected item in the box?



Adding items to ObservableCollection via DataGrid

Hi All, I have a DataGrid bound to an ObservableCollection. I'd like to be able to add objects to the collection via the Grid. When I was working with sample data, I could go to the bottom of the grid, hit enter and add a new entry. Now that I'm using real data I don't seem to be able to do that. I tried taking a look at the class that the SampleData creates and can't quite fathom what it's up to. Does anyone know what I'm missing \ what I need to implement to make this possibe? Thanks Warrick

Show total items for GridView in List.aspx or GridViewPager

Hi, Is there a solution to show total items in Grid View in List.aspx or GridViewPager Eg. Record: 1 - 20 of 231 

Content Query Web Part (CQWP) fails to show picture items from a document/picture library in an anon

I have a Picture Library and am trying to use the CQWP to display a list of items in the library.  The web part shows the items fine in authenticated mode, but it fails to show the items to anonymous users. The error log message is: Error while executing web part: System.NullReferenceException: Object reference not set to an instance of an object.     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.SetDocumentIconUrlAndOnClickString(SPWeb web, DataRow row, String strDefaultItemOpen, Boolean fSetDocIcon, Boolean fSetOnClick, String fileRefColumnRef, String progIdColumnRef, String fsobjTypeColumnRef, String permMaskColumnRef)     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.PreProcessForDocumentIconAndOnClickAttribute()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.AddContentQueryData()     at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryWebPart.GetXPathNavigator(String viewPath)     at Microsoft.SharePoint.WebPartPages.DataFormWebPart.PrepareAndPerformTransform(Boolean bDeferExecuteTransform) I'm running SP 2010.  I've tried various scenarios including: 1. Using the default publishing template. 2. Using the blank site template with publishing and lock down features enabled. 3. Us

Assembly items don't show in SSIS Data Flow

I successfully add a new assembly (MapPoint Batch Geocoder.dll) into GAC using Mscorcfg.msc and I can see it from the assembly list and I've added the dll into SSIS's PipelineComponents folder but for some reason I just cannot see it from SSIS Data Flow Item tab, I saw some others have the similar issue, and I actually tried to fix it based on their solutions such as change the framework version, but nothing changed. I am using VS2008, .NET 3.5 framework. I don't understand how come I can see it from GAC and also can see it through .NET tab in "Add References" but just not from Data Flow Item tab? Any ideas? Thanks a lot!

User Filter web part: how to show items with no value in it

I want to set up a document library View that shows the current user all items with their Department name in a column, as well as those items that don't yet have a Department name. I thought I could do this with the User Filter web part, but I am struggeling to show the items that don't yet have a department name. The problem I have is this: I created a view called "My department's items". I use the User Filter web part on it to show the user all items that have got the user's department name in a column. However, when a user forgets to fill out the department name after uploading a file, or even when they upload the file but then cancel filling out the compulsory fields, the uploaded file disappears from the "My department's items" view (because the department column is empty). How can I set up a filter to show all files that match the current user's department name as well as those that don't have a department name yet? Thanks.

WPF DataGrid does not show new row on empty linq query

I'm using Linq to Entities and bind a linq query to the WPF 4 DataGrid datacontext.  The linq query look something like this:                  var query = from s in this.db.Customers                         orderby s.Name                         select s;             private ContextEntities db = new ContextEntities();             private BindingListCollectionView View;             this.View = ((BindingListCollectionView)CollectionViewSource.GetDefaultView(query));             this.DataContext = this.View; If my Customers table does not have any record, the DataGrid does not show any row for user to add.  I have CanUserAddRows set to true.  I found another post that address this issue but it say to create a new entity type.  http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/cdc0fb6f-2335-42e2-98d7-4bd73ffffc8c My project

Order of the items in a DropDownList inside GridView



I have a DropDownList inside the EditTemplateItem (if the user clicks edit) in a GridView. The DropDownList receives all available rows from the database.

My problem is, if the user clicks Edit in the GridView to edit a row and opens the DropDownList Box the original item is not selected but the first one. That means the items are sorted.

Have someone an idea how I can solve this issue that the right item / the original is selected if I change to edit mode of the grid view?

The only idear that I have is to write some lines in the code behind for the updating event and selected the suitable index manually but I think there must be an easier way.


Show and hide items in the list as per permission (depend on the permission)


Dear all,

In sharepoint 2010

How I Show and hide items in the list as per permission.

i.e the user can fill the most fields in the list and we need to prevent him to see manager's fields in the same list.


Html.DropDownList items with '<'


 How do I tell asp.net to display escape characters in a 



In the select list, there are some '>' and '<'. I used &lt; and &gt; but the page shows &lt; and &gt; instead of '<' and '>'.

Any help?


Help Moving Datagrid items with Up and Down arrows!!



I need some help.  I have a datagrid that has photos and a description of the individual in the photo.  I have a procedure that works and if I execute it with the correct parameters it changes the rows in the table.  I have a datagrid with two image buttons, MoveUp and MoveDown.  I just want to be able to reorder the photos when needed.

In my proc called "MoveMember" I have these parameters that are passed in.  The column that gets swapped in my table is the "OrderBy" column, they are just numeric numbers 1,2,3,4 etc.

So in my procedure 2 and 3 can be interchanged. 

@FMFacultyID INT,
@FMFirstOrderBy INT,
@changeValue INT,
@FMSecondOB INT 

DropDownList selection doesn't show


I've got two DropDownLists that are filled using a couple of SqlDataSources, like so:

    <asp:SqlDataSource ID="dsCategories" runat="server" 
    ConnectionString="<%$ ConnectionStrings:EPiServerDB %>" 
    SelectCommand="img_GetCategories" SelectCommandType="StoredProcedure">
            <asp:Parameter DefaultValue="1" Name="CountryID" Type="Byte" />
    <asp:DropDownList ID="categories" runat="server" AutoPostBack="True" 
    DataSourceID="dsCategories" DataTextField="Translation" 
    DataValueField="CategoryID" Width="220px">
    <asp:SqlDataSource ID="dsSubcategories" runat="server" 
    ConnectionString="<%$ ConnectionStrings:EPiServerDB %>" 
    SelectCommand="img_GetSubcategories" SelectCommandType="StoredProcedure">
            <asp:Parameter DefaultValue="1" Name="CountryID" Type="Byte" />
            <asp:ControlParameter ControlID="categories" DefaultValue="" Name
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