Top DevX Stories
Creating Custom Export Filters for StarOffice with XSLT
WPF Wonders: Using DataTemplates
Crystal Reports Family Offers Options for Developers
Avaya Aura Session Manager video
Avaya Aura Overview video
Search the forums:

Go Back   DevX.com Forums > DevX Developer Forums > ASP.NET

Reply
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 10-27-2009, 04:48 AM
justhottest justhottest is offline
Registered User
 
Join Date: Oct 2009
Location: I rasied in Philippines and residing for the meantime as for work here in Gulf countries
Posts: 1
Angry Store Data Into Dropdownlist Inside GridView EditItemTemplate And FooterTemplate

Is Anyone Encountered Error as Message Like This ==> ASP.NET Using CSharp Visual Studio 2008

"NullReferenceException was unhandled by user code"

Where I just want to Bind DropdownList that declared inside GridView?
Here where I Construct GridView
=======================================================
<asp:GridView ID="GridOne" runat="server" OnRowDataBound="dvg_RowDatabound" AutoGeneratedColumns="Fales">
<Columns>
<asp:TemplateField HeaderText="Code">
<EditItemTemplate>
<aspropDownList ID="DDL" runat="server" ></aspropDownList>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

================== The Code Behind =====================
protected void dvg_RowDatabound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{

DataTable Dtb = Ds.Table[0];

DropDownList DDl1 = (DropDownList) e.Row.FindControl("DDl") as
DropDownList;


DDl1.DataSource=Dtb; << = Error Start Here as Above Error
Appear Message

DDl1.DataMember = "MyDataMember"
DDl1.DataValueField = "MyValue"
DDl1.DataBind();

}


}
=====================================================
Reply With Quote
  #2  
Old 10-27-2009, 02:14 PM
Hack's Avatar
Hack Hack is offline
Super Moderator
 
Join Date: Apr 2007
Location: Sterling Heights, Michigan
Posts: 7,719
Do you know what line is causing the error?
__________________
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista

Microsoft MVP 2005/2006/2007/2008/2009
Reply With Quote
Reply

Bookmarks

Tags
gridview onrowdatabound

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding DropDownList in FooterTemplate (GridView) putts ASP.NET 6 06-12-2008 09:15 AM


All times are GMT -4. The time now is 11:06 PM.


Sponsored Links



Acceptable Use Policy

internet.comMediabistrojusttechjobs.comGraphics.com

WebMediaBrands Corporate Info


Advertise | Newsletters | Feedback | Submit News

Legal Notices | Licensing | Permissions | Privacy Policy


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.