|
|||||||
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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> <asp ropDownList ID="DDL" runat="server" ></asp ropDownList></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(); } } ===================================================== |
|
#2
|
||||
|
||||
|
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 |
![]() |
| Bookmarks |
| Tags |
| gridview onrowdatabound |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Binding DropDownList in FooterTemplate (GridView) | putts | ASP.NET | 6 | 06-12-2008 09:15 AM |