Re: Get Value of Non-ASP.NET Control

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



"Jonathan Wood" <jwood@xxxxxxxxxxxxxxxx> wrote in message news:esUwKPGbJHA.1272@xxxxxxxxxxxxxxxxxxxxxxx

I'm rendering a listbox from code rather than using the ASP.NET ListBox control. So I write <select> and <option> tags to the output.

Hmm - any particular reason...?

Yes, the one I described in my original post.

Assuming all you're trying to achieve is to indent the text portions of the list options, there's no need to do any of this...

Were you just going to express disbelief, or did you have a comment?

The latter...

I really think I have addressed this more than you are giving me credit for.

OK...

I'm happy to post some specific part of the code if you ask.

Now we're getting somewhere...

// Note: We need to render listbox manually do allow unencoded "&nbsp;"

No we don't...

<asp:ListBox ID="lstTest" runat="server" />

lstTest.Items.Add(new ListItem("Please choose a category for this submission...", "-1"));
lstTest.Items.Add(new ListItem(HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;") + "First option", "1"));
lstTest.Items.Add(new ListItem(HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;") + "Second option", "2"));
lstTest.Items.Add(new ListItem(HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;") + "Third option", "3"));
lstTest.Items.Add(new ListItem(HttpUtility.HtmlDecode("&nbsp;&nbsp;&nbsp;&nbsp;") + "Fourth option", "4"));


--
Mark Rae
ASP.NET MVP
http://www.markrae.net

.



Relevant Pages

  • more questions
    ... I'm adding the control to the asp.net toolbox, it adds a new item for each ... In all the sub-classes I'm just getting the tags data, ... I'm using only the Render method of the main ... > nameSpace) but then I realized that it's not very smart because when creating ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • Re: BBEdit and Control p
    ... Control P in an open text doc gets me an html paragraph opening ... the first place so that Control P gets me the tags direct. ... Elements entry. ... Mac UI since the beginning that a command that ends in ellipsis points ...
    (comp.sys.mac.apps)
  • Re: TextBox TextChanged property
    ... "David C" wrote in message ... "Jonathan Wood" wrote in message ... Dim strText As String ... ' the current record in the FormView control. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Creating a watermark for a form
    ... To center the control, try this: ... > In your original post, there is no statement of MDI statement, so I am not ... > I will wait for your further feedback. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: HTML Auto Tagging
    ... microsoft.public.dotnet.framework.aspnet newsgroup, ... Visual Studio to not close your tags for you. ... and ASP.Net Controls correspond to HTML ... be to create a User Control, which is a templated control, to host your ...
    (microsoft.public.vsnet.general)