Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Composit control with Listbox problem

Thread Tools

Composit control with Listbox problem

Posts: n/a
Hi Allen,
I sent you a screen shot and the project back again.


"Allen Chen [MSFT]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Steve,
>>Are you able to get items into the ListBox?

> Do you have any progress on this issue? I've sent two emails to you but
> got
> no reply so far. Please update here if it still doesn't work.
> Regards,
> Allen Chen
> Microsoft Online Support
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> Removed).

Reply With Quote
Posts: n/a
As it turns out, this is an IE 7 rendering issue. Firefox renders the
control fine. I very much appreciate Allen's support on this issue. However,
I must express my dissatisfaction with IE, once again. Wasn't IE 7 supposed
to solve many of these rendering issues? The issue being that I was
specifying the width in the Render routine for the listbox at 100% (of the
td tag) rather than an absolute value. I'm told that IE 8 has resolved this
issue. However, our entire company just moved to IE 7 with little to no
chance of getting us to move to IE 8 at this time. Okay, so maybe this is a
rant and maybe I'm just being lazy by not checking which browser the client
is using.
If I'm not mistaken and I remember correctly, Firefox can have issues if you
specify an abosolute value for some controls. I have not tested this last
issue on the listbox however.
Okay, I guess I'm done with my rant now and I hope this post helps someone
else down the road.

Thanks again Allen for your support.


"William Niver" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Howdy!
> One of the major issues is that you should be using "MyBase", not "Me" and
> "MyBase.Controls.Clear()" instead of just "Controls.Clear()".
> Example:
> Protected Overrides Sub CreateChildControls()
> MyBase.Controls.Clear()
> <Other stuff>
> MyBase.Controls.Add(list)
> MyBase.Controls.Add(btnSubmit)
> End Sub
> Hope that helps!
> William
> "SAL" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Hi,
>> I am developing a composit control (inheriting from that class) that uses
>> another class that inherits from ListBox.
>> My composite control has a value called GridViewID which takes the id of
>> a GridView and if it is not null, takes the columns and lists them in the
>> listbox so the user can select which columns to export (to a CSV file for
>> Excel).
>> When my composit control load, it's executing the code that adds the
>> items to the listbox but the items are not showing up on the page that
>> hosts the composite control. It's probably something very simple but I
>> can't seem to make the items display in the listbox.
>> P.S. there's not much error checking in the code yet as I'm just trying
>> to get the items in the list to display at this point. Any help is much
>> appreciated.
>> Here's my CreateChildControls override:
>> Protected Overrides Sub CreateChildControls()
>> Controls.Clear()
>> list = New ExportColumnsList
>> list.ID = "lstExport"
>> list.GridviewID = Me.GridviewID
>> list.ContainerPanelID = Me.ContainerPanelID
>> btnSubmit = New Button()
>> btnSubmit.ID = "btnSubmit"
>> btnSubmit.Text = ButtonText
>> AddHandler btnSubmit.Click, AddressOf btnSubmit_Click
>> Me.Controls.Add(list)
>> Me.Controls.Add(btnSubmit)
>> End Sub
>> Protected Overrides Sub RecreateChildControls()
>> EnsureChildControls()
>> End Sub
>> Private Sub ColumnExportTool_PreRender(ByVal sender As Object, ByVal e As
>> System.EventArgs) Handles Me.PreRender
>> LoadList()
>> End Sub
>> Protected Sub LoadList()
>> If ContainerPanelID <> String.Empty Then
>> If GridviewID <> String.Empty Then
>> list.GetGVInContainer(GridviewID, ContainerPanelID)
>> End If
>> ElseIf GridviewID <> String.Empty Then
>> list.GetGVColumns(GridviewID)
>> End If
>> End Sub
>> From the ExportColumnList class:
>> Protected Friend Sub GetGVColumns(ByVal id As String)
>> Dim gv As GridView = Page.FindControl(id)
>> GetColumns(gv)
>> End Sub
>> Protected Friend Sub GetGVInContainer(ByVal gridId As String, ByVal
>> panelId As String)
>> Dim gv As GridView = Nothing
>> Dim ctl As Control = Page.FindControl(panelId)
>> If Not ctl Is Nothing Then
>> gv = ctl.FindControl(gridId)
>> GetColumns(gv)
>> End If
>> End Sub
>> Private Sub GetColumns(ByVal gv As GridView)
>> Dim li As ListItem
>> If Not gv Is Nothing Then
>> Dim dcfc As DataControlFieldCollection
>> dcfc = gv.Columns
>> For Each dcf As DataControlField In dcfc
>> If dcf.Visible Then
>> li = New ListItem
>> li.Text = dcf.HeaderText
>> li.Value = dcf.SortExpression
>> Items.Add(li)
>> End If
>> Next
>> End If
>> End Sub
>> S


Reply With Quote

Thread Tools

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Composit control and property value after postback BB ASP .Net 1 11-16-2005 08:40 AM
How do I move all items in a listbox to another listbox kent ASP .Net 1 05-03-2004 12:17 AM
click listbox and refresh another listbox DC Gringo ASP .Net 0 04-06-2004 02:13 AM
Rendering non-composit Control MartinL ASP .Net Building Controls 2 11-13-2003 10:00 AM
Re: now desparate! - 1st listbox contents disappears when 2nd listbox appears? blenderdude ASP .Net 0 08-03-2003 10:18 PM