I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks 6 2757
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks
The listbox is currently in the aspx, bound like this:
<TD vAlign="top" align="right">
<asp:label id="Label13" runat="server" CssClass="form-label">Trades</asp:label>
</TD>
<TD>
<asp:listbox id="lstTrades" runat="server" CssClass="form-text" Width="154px" SelectionMode="Multiple" DataSource='<%# ContactInfo1 %>' DataMember="Trades" DataTextField="TradeName" DataValueField="TradeID">
</asp:listbox>
</TD>
I have code similar to your examples in the codebehind, but I'm having a hard time finding a place where the Listbox is available as an object (or perhaps my code is fubar). I'm trying to get the listbox reference for the asp:listbox item above by doing the following (in this case, I was doing it during the event that bound the data. e is a DataListCommandEventArgs):
lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)
I think once I get to that point, the actual selection based on the data will be easy. So far, I haven't found a good place to hook this line (I keep getting back Nothing).
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl...
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks
A good spot is probably Page_Load; if you are using the default code that VS.NET generates then this method should be there.... again, if you are using VS.NET there should already be a member field call "lstTrades" as a protected member of the code behind for the ASPX page.
If you want the ListBox during a ListBox DataBinding event; then just CType the sender (the first parent) to the event handler; In C# that might look like (for the ListBox DataBindingEvent):
private void lstTrades_DataBinding(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
}
I'm a bit confused if you if you are trying to bind the data to the ListBox in an event for the ListBox; if that's what you are asking, then I think you'd be better off binding the data to the ListBox in the containing page.
Scott
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
The listbox is currently in the aspx, bound like this:
<TD vAlign="top" align="right">
<asp:label id="Label13" runat="server" CssClass="form-label">Trades</asp:label>
</TD>
<TD>
<asp:listbox id="lstTrades" runat="server" CssClass="form-text" Width="154px" SelectionMode="Multiple" DataSource='<%# ContactInfo1 %>' DataMember="Trades" DataTextField="TradeName" DataValueField="TradeID">
</asp:listbox>
</TD>
I have code similar to your examples in the codebehind, but I'm having a hard time finding a place where the Listbox is available as an object (or perhaps my code is fubar). I'm trying to get the listbox reference for the asp:listbox item above by doing the following (in this case, I was doing it during the event that bound the data. e is a DataListCommandEventArgs):
lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)
I think once I get to that point, the actual selection based on the data will be easy. So far, I haven't found a good place to hook this line (I keep getting back Nothing).
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl...
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks
I did bind the list data in the asp:listbox. What I'm trying to do now is mark certain items as selected, which is found in a different table. To be specific, the listbox contains trades (Plumbing, Electrical, Masonry, etc), and a second table contains the trades that apply to the displayed form (i.e. this vendor does this sort of work). This listbox is part of an Edit Template on a DataList (so that the selections can be changed).
I chose DataBinding() only as an example of where I have tried to get a reference to the listbox (it didn't work). I had to define the listbox in the code (VS.NET did not create a reference to it; I figured it was because it was part of the Edit Template, which is late bound), so I felt that I needed to find a place in the process where the listbox was created, but not yet sent back to the browser. The point where the data is bound seemed to make the most sense to me, but I can't grab a reference to it.
Thanks for your help so far.
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:eO**************@TK2MSFTNGP10.phx.gbl...
A good spot is probably Page_Load; if you are using the default code that VS.NET generates then this method should be there.... again, if you are using VS.NET there should already be a member field call "lstTrades" as a protected member of the code behind for the ASPX page.
If you want the ListBox during a ListBox DataBinding event; then just CType the sender (the first parent) to the event handler; In C# that might look like (for the ListBox DataBindingEvent):
private void lstTrades_DataBinding(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
}
I'm a bit confused if you if you are trying to bind the data to the ListBox in an event for the ListBox; if that's what you are asking, then I think you'd be better off binding the data to the ListBox in the containing page.
Scott
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
The listbox is currently in the aspx, bound like this:
<TD vAlign="top" align="right">
<asp:label id="Label13" runat="server" CssClass="form-label">Trades</asp:label>
</TD>
<TD>
<asp:listbox id="lstTrades" runat="server" CssClass="form-text" Width="154px" SelectionMode="Multiple" DataSource='<%# ContactInfo1 %>' DataMember="Trades" DataTextField="TradeName" DataValueField="TradeID">
</asp:listbox>
</TD>
I have code similar to your examples in the codebehind, but I'm having a hard time finding a place where the Listbox is available as an object (or perhaps my code is fubar). I'm trying to get the listbox reference for the asp:listbox item above by doing the following (in this case, I was doing it during the event that bound the data. e is a DataListCommandEventArgs):
lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)
I think once I get to that point, the actual selection based on the data will be easy. So far, I haven't found a good place to hook this line (I keep getting back Nothing).
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl...
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks
Got it; here's an example in C# that gets you to the control; in the DG_EditCommand handler, you'll see that I grab the index of the item and then grab the item to get the ListBox1; now this seems to be the same as the code you posted in a message or two ago. If you run this page as a test you should see the "found control" message.
Scott
<%@ Page language="c#" AutoEventWireup="false" Trace="true" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>DGBind</title>
<script language="C#" runat="server">
protected override void OnLoad(EventArgs e)
{
this.DG.DataSource = MyFakeDataSet;
this.DG.DataMember = "Table1";
this.DG.EditCommand += new DataGridCommandEventHandler(DG_EditCommand);
this.DG.CancelCommand += new DataGridCommandEventHandler(DG_CancelCommand);
if (!this.IsPostBack)
{
this.DG.DataBind();
}
}
private void DG_EditCommand(object source, DataGridCommandEventArgs e)
{
this.DG.EditItemIndex = e.Item.ItemIndex;
this.DG.DataBind();
ListBox lb = (ListBox)this.DG.Items[e.Item.ItemIndex].FindControl("ListBox1");
if (lb != null)
{
this.Trace.Warn("found control");
}
}
private void DG_CancelCommand(object source, DataGridCommandEventArgs e)
{
this.DG.EditItemIndex = -1;
this.DG.DataBind();
}
private DataSet m_ds;
private DataSet MyFakeDataSet {
get {
if (m_ds != null) {
return m_ds;
}
m_ds = new DataSet();
DataTable t = new DataTable("Table1");
t.Columns.Add("Column1");
m_ds.Tables.Add(t);
for (int i = 0; i < 10; i++) {
DataRow r = m_ds.Tables[0].NewRow();
r["Column1"] = i.ToString();
m_ds.Tables[0].Rows.Add(r);
}
return m_ds;
}
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:datagrid id="DG" runat="server" autogeneratecolumns="False">
<columns>
<asp:editcommandcolumn buttontype="LinkButton" updatetext="Update" headertext="Column1" canceltext="Cancel"
edittext="Edit"></asp:editcommandcolumn>
<asp:templatecolumn headertext="Column1">
<itemtemplate>
<asp:Label id="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Column1") %>'>
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:listbox id="ListBox1" runat="server"></asp:listbox>
</edititemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
</form>
</body>
</html>
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:eu*************@TK2MSFTNGP11.phx.gbl...
I did bind the list data in the asp:listbox. What I'm trying to do now is mark certain items as selected, which is found in a different table. To be specific, the listbox contains trades (Plumbing, Electrical, Masonry, etc), and a second table contains the trades that apply to the displayed form (i.e. this vendor does this sort of work). This listbox is part of an Edit Template on a DataList (so that the selections can be changed).
I chose DataBinding() only as an example of where I have tried to get a reference to the listbox (it didn't work). I had to define the listbox in the code (VS.NET did not create a reference to it; I figured it was because it was part of the Edit Template, which is late bound), so I felt that I needed to find a place in the process where the listbox was created, but not yet sent back to the browser. The point where the data is bound seemed to make the most sense to me, but I can't grab a reference to it.
Thanks for your help so far.
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:eO**************@TK2MSFTNGP10.phx.gbl...
A good spot is probably Page_Load; if you are using the default code that VS.NET generates then this method should be there.... again, if you are using VS.NET there should already be a member field call "lstTrades" as a protected member of the code behind for the ASPX page.
If you want the ListBox during a ListBox DataBinding event; then just CType the sender (the first parent) to the event handler; In C# that might look like (for the ListBox DataBindingEvent):
private void lstTrades_DataBinding(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
}
I'm a bit confused if you if you are trying to bind the data to the ListBox in an event for the ListBox; if that's what you are asking, then I think you'd be better off binding the data to the ListBox in the containing page.
Scott
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
The listbox is currently in the aspx, bound like this:
<TD vAlign="top" align="right">
<asp:label id="Label13" runat="server" CssClass="form-label">Trades</asp:label>
</TD>
<TD>
<asp:listbox id="lstTrades" runat="server" CssClass="form-text" Width="154px" SelectionMode="Multiple" DataSource='<%# ContactInfo1 %>' DataMember="Trades" DataTextField="TradeName" DataValueField="TradeID">
</asp:listbox>
</TD>
I have code similar to your examples in the codebehind, but I'm having a hard time finding a place where the Listbox is available as an object (or perhaps my code is fubar). I'm trying to get the listbox reference for the asp:listbox item above by doing the following (in this case, I was doing it during the event that bound the data. e is a DataListCommandEventArgs):
lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)
I think once I get to that point, the actual selection based on the data will be easy. So far, I haven't found a good place to hook this line (I keep getting back Nothing).
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl...
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks
Thanks, that worked. I converted the C# into VB and it looked like this:
lstTrades = CType(dlContactList.Items(e.Item.ItemIndex).FindCo ntrol("lstTrades"), ListBox)
VB casting is nasty looking to me (I much prefer C#, but I inherited this project....you know how that goes...). Anyway, you can see that the old line (lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)) is simply looking in the wrong Item collection. Would help to look in the DataList hierarchy. Duh.
Thanks for the help
Chris
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:uB**************@TK2MSFTNGP10.phx.gbl...
Got it; here's an example in C# that gets you to the control; in the DG_EditCommand handler, you'll see that I grab the index of the item and then grab the item to get the ListBox1; now this seems to be the same as the code you posted in a message or two ago. If you run this page as a test you should see the "found control" message.
Scott
<%@ Page language="c#" AutoEventWireup="false" Trace="true" %>
<%@ Import Namespace="System.Data" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<title>DGBind</title>
<script language="C#" runat="server">
protected override void OnLoad(EventArgs e)
{
this.DG.DataSource = MyFakeDataSet;
this.DG.DataMember = "Table1";
this.DG.EditCommand += new DataGridCommandEventHandler(DG_EditCommand);
this.DG.CancelCommand += new DataGridCommandEventHandler(DG_CancelCommand);
if (!this.IsPostBack)
{
this.DG.DataBind();
}
}
private void DG_EditCommand(object source, DataGridCommandEventArgs e)
{
this.DG.EditItemIndex = e.Item.ItemIndex;
this.DG.DataBind();
ListBox lb = (ListBox)this.DG.Items[e.Item.ItemIndex].FindControl("ListBox1");
if (lb != null)
{
this.Trace.Warn("found control");
}
}
private void DG_CancelCommand(object source, DataGridCommandEventArgs e)
{
this.DG.EditItemIndex = -1;
this.DG.DataBind();
}
private DataSet m_ds;
private DataSet MyFakeDataSet {
get {
if (m_ds != null) {
return m_ds;
}
m_ds = new DataSet();
DataTable t = new DataTable("Table1");
t.Columns.Add("Column1");
m_ds.Tables.Add(t);
for (int i = 0; i < 10; i++) {
DataRow r = m_ds.Tables[0].NewRow();
r["Column1"] = i.ToString();
m_ds.Tables[0].Rows.Add(r);
}
return m_ds;
}
}
</script>
</head>
<body>
<form id="Form1" method="post" runat="server">
<asp:datagrid id="DG" runat="server" autogeneratecolumns="False">
<columns>
<asp:editcommandcolumn buttontype="LinkButton" updatetext="Update" headertext="Column1" canceltext="Cancel"
edittext="Edit"></asp:editcommandcolumn>
<asp:templatecolumn headertext="Column1">
<itemtemplate>
<asp:Label id="Label1" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Column1") %>'>
</asp:label>
</itemtemplate>
<edititemtemplate>
<asp:listbox id="ListBox1" runat="server"></asp:listbox>
</edititemtemplate>
</asp:templatecolumn>
</columns>
</asp:datagrid>
</form>
</body>
</html>
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:eu*************@TK2MSFTNGP11.phx.gbl...
I did bind the list data in the asp:listbox. What I'm trying to do now is mark certain items as selected, which is found in a different table. To be specific, the listbox contains trades (Plumbing, Electrical, Masonry, etc), and a second table contains the trades that apply to the displayed form (i.e. this vendor does this sort of work). This listbox is part of an Edit Template on a DataList (so that the selections can be changed).
I chose DataBinding() only as an example of where I have tried to get a reference to the listbox (it didn't work). I had to define the listbox in the code (VS.NET did not create a reference to it; I figured it was because it was part of the Edit Template, which is late bound), so I felt that I needed to find a place in the process where the listbox was created, but not yet sent back to the browser. The point where the data is bound seemed to make the most sense to me, but I can't grab a reference to it.
Thanks for your help so far.
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:eO**************@TK2MSFTNGP10.phx.gbl...
A good spot is probably Page_Load; if you are using the default code that VS.NET generates then this method should be there.... again, if you are using VS.NET there should already be a member field call "lstTrades" as a protected member of the code behind for the ASPX page.
If you want the ListBox during a ListBox DataBinding event; then just CType the sender (the first parent) to the event handler; In C# that might look like (for the ListBox DataBindingEvent):
private void lstTrades_DataBinding(object sender, EventArgs e)
{
ListBox lb = (ListBox)sender;
}
I'm a bit confused if you if you are trying to bind the data to the ListBox in an event for the ListBox; if that's what you are asking, then I think you'd be better off binding the data to the ListBox in the containing page.
Scott
"Chris Leuty" <chris.leuty-at-nospam.brinker.com> wrote in message news:%2***************@TK2MSFTNGP09.phx.gbl...
The listbox is currently in the aspx, bound like this:
<TD vAlign="top" align="right">
<asp:label id="Label13" runat="server" CssClass="form-label">Trades</asp:label>
</TD>
<TD>
<asp:listbox id="lstTrades" runat="server" CssClass="form-text" Width="154px" SelectionMode="Multiple" DataSource='<%# ContactInfo1 %>' DataMember="Trades" DataTextField="TradeName" DataValueField="TradeID">
</asp:listbox>
</TD>
I have code similar to your examples in the codebehind, but I'm having a hard time finding a place where the Listbox is available as an object (or perhaps my code is fubar). I'm trying to get the listbox reference for the asp:listbox item above by doing the following (in this case, I was doing it during the event that bound the data. e is a DataListCommandEventArgs):
lstTrades = CType(e.Item.FindControl("lstTrades"), ListBox)
I think once I get to that point, the actual selection based on the data will be easy. So far, I haven't found a good place to hook this line (I keep getting back Nothing).
"Scott G." <no*****@this-is-extra-hotmail.com> wrote in message news:OE**************@tk2msftngp13.phx.gbl...
I think you should be able to do this with a single table; have you tried something like:
ListBox lb = new ListBox();
lb.SelectionMode = ListSelectionMode.Multiple;
lb.DataSource = whatever;
lb.DataBind();
// now set from the list box
foreach (ListItem item in lb.Items)
{
if (IsItemSelected(item.Value)) // IsItemSelected is your method
{
item.Selected = true;
}
}
// or do it from the data side
foreach (DataRow row in whatever)
{
// blah, whatever you have to determine what's selected.
if (row["IsSelected"] == "True")
{
lb.Items.FindByValue(row["Value"].ToString()).Selected = true;
}
}
Scott
"Chris Leuty" <ch*********@nospam.briniker.com> wrote in message news:OY**************@tk2msftngp13.phx.gbl...
I am populating a multiselect Listbox from a dataset, with the content of
the listbox filled by one table, and the selections determined from another
table. So far, I have been keeping the dataset a denormalized mirror of the
database, but I'm not having much luck getting the selection logic down (I
haven't found a 'hook' where I can access the listbox object as an object to
set the listitem's selected property before it gets rendered)..
Before denormalizing the data in hopes of simplifying the binding, I thought
I would ask if I was missing an obviously simple approach to doing what I am
after (and leaving the dataset denormalized).
Thanks This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Broder |
last post by:
Hi there,
I am currently running into a somewhat weired problem and hope that this NG
is able to help ;-)
I have a table in a MSSQL Server in...
|
by: cloverme |
last post by:
Hi,
I need help populating a listbox from a database on a webform.
I created a an access database with a table, fields and data. Then I...
|
by: Bill Brinkworth |
last post by:
I want the user to type in part of a word, and I want to return all words
from an Access word table that contains specified letters. If they were to...
|
by: Deano |
last post by:
I needed to have a listbox populated by locations which are stored in
tblLocations.
However I wanted an "All locations" entry to be at the top of...
|
by: collie |
last post by:
Hi,
I have 2 listboxes. The first gets populated from the db as soon as
the page loads. The second listbox get populated based on the user's...
|
by: P K |
last post by:
I have a listbox which I am populating on the client (it contains a list of
dates selected from calender). The listbox is a server control.
When I...
|
by: NasirMunir |
last post by:
I am trying to populate a listbox from another listbox on a access form. My first listbox has names of tables on a linked odbc databse. I am trying...
|
by: NvrBst |
last post by:
I populate a ListBox with a LogFile that has about (~1000 lines). The
ListBox's datasource is a BindingList<string>. Whenever I add the
elements,...
|
by: dkohel |
last post by:
I have 2 list boxes on my form. I am trying to populate listbox B
with the selection from listbox A. I have set multi-select in both
boxes to...
|
by: Kemmylinns12 |
last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
|
by: jalbright99669 |
last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
|
by: antdb |
last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine
In the overall architecture, a new "hyper-convergence" concept was...
|
by: Matthew3360 |
last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
|
by: Arjunsri |
last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
|
by: WisdomUfot |
last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
|
by: Oralloy |
last post by:
Hello Folks,
I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA.
My problem (spelled failure) is with the...
|
by: BLUEPANDA |
last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
|
by: Rahul1995seven |
last post by:
Introduction:
In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...
| |