robespierre_2010
asked on
Bulleted List Master Detail with DisplayMode=LinkButton (C#)
Hi,
I need to do the following: after calling a web service, the result of that call is a list. I need to display that list in a Master/Detail way using a bulleted list for the Master data and the LinkButton DisplayMode for the Detail data of each item.
With the code I currently have, I can display the Master data of the list with the Button1_click event handler, but I cannot display the details with the BulletedListMedicare_click .
when I use
LabelMedicare3.Text = supList.SupplierDatas[n].C ompanyName
to access the data in the list, I get an error. This may have to do with the scope of the list, but I am new to C# so am lost.
Thanks in advance and regards.
I need to do the following: after calling a web service, the result of that call is a list. I need to display that list in a Master/Detail way using a bulleted list for the Master data and the LinkButton DisplayMode for the Detail data of each item.
With the code I currently have, I can display the Master data of the list with the Button1_click event handler, but I cannot display the details with the BulletedListMedicare_click
when I use
LabelMedicare3.Text = supList.SupplierDatas[n].C
to access the data in the list, I get an error. This may have to do with the scope of the list, but I am new to C# so am lost.
Thanks in advance and regards.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
using System.Configuration;
using System.Data;
using System.Web.Security;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls.Adapters;
using System.Xml.Linq;
using System.Data.SqlClient;
using System.IO;
using System.Xml.XPath;
using System.Xml.Xsl;
using System.Net;
using InfoSoftGlobal;
public partial class Medicare : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
medicare.MediCareSupplier mc = new medicare.MediCareSupplier();
medicare.SupplierDataList supList;
bool resOK;
resOK = mc.GetSupplierByZipCode(TextBox1.Text, out supList);
for (int i = 0; i < supList.TotalRecords; i++)
{
BulletedListMedicare.Items.Add(supList.SupplierDatas[i].CompanyName);
}
}
protected void BulletedListMedicare_click(object sender,BulletedListEventArgs e)
{
ListItem li = BulletedListMedicare.Items[e.Index];
LabelMedicare1.Text = "You selected = " + li.Text + ", with value = "
+ li.Value;
LabelMedicare2.Text = "The Index of Item you clicked: " + e.Index + "<br> The value of Item you clicked: " + BulletedListMedicare.Items[e.Index].Text;
this.BulletedListMedicare.Focus();
int n = e.Index;
LabelMedicare3.Text = supList.SupplierDatas[n].CompanyName;
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.