Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old May 24th, 2006, 10:42 AM
Authorized User
 
Join Date: Apr 2006
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default hyperlink in nested datalist

Here the situation is like this.
On my page I am listing the name of campuses grouped my state.Then when the user clicks on the campus , the listing of rental locations under that particular campus pops up in the repeater.
In a seperate file I can show the campuses grouped by state, and it is running. In another file if I just click on campus it shows the the rental location. But If I combine all three of them together it gives me an error. PLease help-

So it looks like this-
Arizona
-campus A
-campus B
California
-campus c
-campus d

If the user clicks on -campus A ,then all the rental locations under campus A will show in a repeater.

<asp:DataList id="DataList" style="Z-INDEX: 101; LEFT: 48px; POSITION: absolute; TOP: 56px" runat="server">
<SelectedItemStyle BackColor="#FFFFC0"></SelectedItemStyle>
<ItemTemplate>
<h2><%# DataBinder.Eval(Container,"DataItem.statefull")%></h2>
<asp:DataList id="DataList1" DataSource='<%# Showcampus(DataBinder.Eval(Container,"DataItem.sta teid"))%>' Runat="server">
                        <ItemTemplate>[list]
<li>
<asp:LinkButton ID="Linkbutton2" Runat="server" Text='<%# DataBinder.Eval(Container,"DataItem.name")%>'>
</asp:LinkButton>
</li>
</ul>
</ItemTemplate>
</asp:DataList>
</ItemTemplate>
</asp:DataList>
<DIV style="Z-INDEX: 102; LEFT: 408px; WIDTH: 272px; POSITION: absolute; TOP: 56px; HEIGHT: 224px" ms_positioning="FlowLayout">
<asp:Repeater id="Repeater1" runat="server">
<ItemTemplate>
<li>
<%# DataBinder.Eval(Container, "DataItem.facility_center_name")%>
</li>
</ItemTemplate>
<SeparatorTemplate>

</SeparatorTemplate>
</asp:Repeater></DIV>

the code behind--
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
sqlDataAdapter1.Fill(dataSet1);
sqlDataAdapter2.Fill(dataSet1);
sqlDataAdapter3.Fill(dataSet1);
DataList.DataSource = dataSet1;
DataList.DataMember = "tbl_state";
DataList1.DataSource = dataSet1;
DataList1.DataKeyField ="campus_id";
DataList.DataBind();
DataList1.DataBind();

}
public DataView Showcampus(object stateid)
{
string strFilter = "stateid=" + stateid;
DataView dvcampus = new DataView(
dataSet1.Tables[ "tbl_location" ],
strFilter,
"name",
DataViewRowState.CurrentRows);
return dvcampus;
}
private void DataList1_ItemCommand(object source, System.Web.UI.WebControls.DataListCommandEventArgs e)
{
DataList1.SelectedIndex = e.Item.ItemIndex;
int intPrimaryKey = (int)DataList1.DataKeys[e.Item.ItemIndex];
sqlDataAdapter3.SelectCommand.Parameters["@campus_id"].Value=intPrimaryKey;
sqlDataAdapter3.Fill(dataSet1);
Repeater1.DataSource = dataSet1;
Repeater1.DataBind();
}

Reply With Quote
  #2 (permalink)  
Old May 24th, 2006, 02:14 PM
Friend of Wrox
Points: 2,077, Level: 18
Points: 2,077, Level: 18 Points: 2,077, Level: 18 Points: 2,077, Level: 18
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2003
Location: , , .
Posts: 594
Thanks: 6
Thanked 3 Times in 3 Posts
Default

What's the error?

Reply With Quote
  #3 (permalink)  
Old May 25th, 2006, 09:12 AM
Authorized User
 
Join Date: Apr 2006
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The error says "Object reference not set to an instance of an object" Problem with DataList1

Reply With Quote
  #4 (permalink)  
Old June 5th, 2006, 02:17 PM
jgd jgd is offline
Registered User
 
Join Date: May 2006
Location: traverse city, mi, USA.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to jgd
Default

i'm having this same problem.... except in mine i've got everything working... then I even am printing out my sql to the screen, which uses a textbox in the edititemtemplate of a nested datalist... anyone got any suggestions?

Joseph
wdweb.com
Reply With Quote
Reply


Thread Tools
Display Modes

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
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataList with HyperLink Ioulia ASP.NET 1.x and 2.0 Application Design 2 May 7th, 2011 12:41 PM
Nested datalist arijoy ASP.NET 1.0 and 1.1 Professional 0 December 6th, 2006 12:23 PM
hyperlink in nested datalist calling a repeater debjanib C# 1 May 25th, 2006 08:17 AM
Using Javascript in Nested Datalist savan_thakkar ASP.NET 1.0 and 1.1 Professional 0 March 21st, 2006 04:54 PM
Nested DataList Problem orcities C# 0 July 12th, 2004 01:40 PM



All times are GMT -4. The time now is 09:33 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.