Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 18th, 2004, 08:20 PM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataList Is not showing Data using ASP.NET and C#

I have to get data from a Oracle DB and show it based on the user input for Where clause.

I have created 2 DropDownList and populating them from DB using page_load method.

User picks up the desired value and clicks on the submit button.

Code behind the click event connects to the oracle using oleDb, generates sql, fills the DataSet and binds it to the DataList.

But no data, only the labels in template is showing up. However, if I use a DataGrid, it is showing the data.

Please help - this is my first form in .NET .

Thanks
Kmazumdar


 
Old August 18th, 2004, 10:23 PM
Authorized User
 
Join Date: Aug 2004
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default

DataList ?
What i understand ur describes is U have a form that contain some textbox and dropdownlist, u have successful bind some data from db to the 2 dropdown list.

then when submit the data by click a button, it doesnt save into db but show the data on the grid only is it ?

is it asp.net or ???

~ Human Knowledge Belongs to the World !
 
Old August 19th, 2004, 07:45 AM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

What does the markup for the DataList control look like?
 
Old August 19th, 2004, 11:40 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Here is the markup for DataList
Code:
<asp:datalist id="DataList1" style="Z-INDEX: 110; LEFT: 133px; POSITION: absolute; TOP: 364px" runat="server" Width="539px" Height="92px" RepeatLayout=Flow>
                                <ItemTemplate>
                                    <TABLE>
                                        <tr>
                                            <td><b>NPA: </b>
                                                <asp:label id=lblNpa td < text='<%# DataBinder.Eval(Container.DataItem,"C1") %>'</td>
                                            <td><b>NXX: </b>
                                                <asp:label id="lblNxx" text='<%# DataBinder.Eval(Container.DataItem,"C2") %>' </td>
                                            <td><b>LATA: </b>
                                                <asp:label id="lblLata" text='<%# DataBinder.Eval(Container.DataItem,"C3") %>' </td>
                                        </tr>
                                        <tr>
                                            <td><b>Time Zone: </b>
                                                <asp:label id="lblTimeZone" text='<%# DataBinder.Eval(Container.DataItem,"C4") %>' </td>
                                            <td><b>Day Light Saving : </b>
                                                <asp:label id="lblDayLightSav" text='<%# DataBinder.Eval(Container.DataItem,"C5") %>' </td>
                                            <td><b>State Code: </b>
                                                <asp:label id="lblStateCd" text='<%# DataBinder.Eval(Container.DataItem,"C6") %>' </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3"><b>Split From NPA: </b>
                                                <asp:label id="lblSplitFromNpa" text='<%# DataBinder.Eval(Container.DataItem,"C7") %>' </td>
                                        </tr>
                                        <tr>
                                            <td colspan="3"><b>Split From NXX: </b>
                                                <asp:label id="lblSplitFromNxx" text='<%# DataBinder.Eval(Container.DataItem,"C8") %>' </td>
                                        </tr>
                                        <tr>
                                            <td><b>Vertical Coordinate: </b>
                                                <asp:label id="lblVerticalCoordinate" text='<%# DataBinder.Eval(Container.DataItem,"C9") %>' </td>
                                            <td><b>Horizontal Coordinate : </b>
                                                <asp:label id="lblHorizontalCoordinate" text='<%# DataBinder.Eval(Container.DataItem,"C10") %>' </td>
                                            <td>&nbsp;</td>
                                        </tr>
                                        <tr>
                                            <td colspan="3"><b>Border Town: </b>
                                                <asp:label id="lblBorderTown" text='<%# DataBinder.Eval(Container.DataItem,"C11") %>' </td>
                                        </tr>
                                    </TABLE>
                                </ItemTemplate>
                            </asp:datalist>

===================
Code behind the click event of submit button
===================
Code:
DataList1.DataSource = ds;
DataList1.DataBind();

 
Old August 19th, 2004, 12:29 PM
planoie's Avatar
Friend of Wrox
 
Join Date: Aug 2003
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

A) This line is incorrect:
<asp:label id=lblNpa td < text='<%# DataBinder.Eval(Container.DataItem,"C1") %>'</td>

B) None of your label's are "runat='server'". Add that and see what happens.
 
Old August 20th, 2004, 10:18 AM
Registered User
 
Join Date: Aug 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you.

I remove the label tag completely and it is working. However with 'runat"server"' directive, I was getting an error message saying Server directive not properly formed.

Thanks for all the help.






Similar Threads
Thread Thread Starter Forum Replies Last Post
Crystal not showing data tgraham Crystal Reports 4 September 9th, 2009 02:46 AM
IF condition in ASP.NET DataList surendran ASP.NET 3.5 Basics 1 October 31st, 2008 01:44 PM
Same data showing in PDF artarasan ASP.NET 2.0 Basics 1 July 3rd, 2007 01:10 AM
New Install of ASP.Net Won't Display DataList scott.ferguson ASP.NET 1.0 and 1.1 Basics 5 January 12th, 2007 05:21 AM
DataList ItemCommand event problem in ASP.NET page naidukap ASP.NET 1.0 and 1.1 Professional 0 December 26th, 2005 03:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.