Datalist won't display
-
Hello, I've been working on an e-commerce site for a couple of weeks. I'm at a point where I want to use a datalist to display a subset of my catalog. Well, nothing in the datalist displays when I bring up the page in IE with either IIS 7 or VS built-in iis server. I've isolated a simple piece of code that illustrates my dilemna within a defalut.aspx file: <form id="form1" runat="server"> <div> <asp:DataList ID="DataList1" runat="server"> <ItemTemplate> Hello! </ItemTemplate> </asp:DataList> </div> </form> This page should show: "Hello", yet the page is blank. More configuration details: - running Windows 7 - VS 2008 - IIS 7 Any assistance or suggestions to point me in the right direction would be greatly appreciated. Thanks in advance.
-
Hello, I've been working on an e-commerce site for a couple of weeks. I'm at a point where I want to use a datalist to display a subset of my catalog. Well, nothing in the datalist displays when I bring up the page in IE with either IIS 7 or VS built-in iis server. I've isolated a simple piece of code that illustrates my dilemna within a defalut.aspx file: <form id="form1" runat="server"> <div> <asp:DataList ID="DataList1" runat="server"> <ItemTemplate> Hello! </ItemTemplate> </asp:DataList> </div> </form> This page should show: "Hello", yet the page is blank. More configuration details: - running Windows 7 - VS 2008 - IIS 7 Any assistance or suggestions to point me in the right direction would be greatly appreciated. Thanks in advance.
on page loadon the server side , you are missing the following code
DataList1.DataBind();
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
-
on page loadon the server side , you are missing the following code
DataList1.DataBind();
Vuyiswa Maseko, Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code. C#/VB.NET/ASP.NET/SQL7/2000/2005/2008 http://www.vuyiswamaseko.com vuyiswa@its.co.za http://www.itsabacus.co.za/itsabacus/
I apologize, I knew there was something I left out. This is what I had in the code-behind: protected void Page_Load(object sender, EventArgs e) { DataList1.DataBind(); } So, I have a "Default3.aspx" file with the DataList1 control, and a "Default3.aspx.cs" file with the DataBind() call.
-
I apologize, I knew there was something I left out. This is what I had in the code-behind: protected void Page_Load(object sender, EventArgs e) { DataList1.DataBind(); } So, I have a "Default3.aspx" file with the DataList1 control, and a "Default3.aspx.cs" file with the DataBind() call.
jboyd111 wrote:
DataList1.DataBind();
That's OK, but you need to tell the datasource from where the data is to be used.
Manas Bhardwaj Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.