C
cweeks
Dev env: VS 2005 C# Express, .Net Framework 2.0
I am trying to programmatically select an item in a listbox on a web
page. The first thing I do is go through and de-select any selected
items. The OuterHtml field of a selected element in the listbox looks
something like this:
<OPTION value=* selected>Default item</OPTION>
I want to simply remove the the term 'selected' this way:
elt.OuterHtml = elt.OuterHtml.Replace("selected","");
This results in OuterHtml being set to:
<OPTION value=* selected></OPTION>
Notice: 1) the 'selected' term is untouched, 2) the visible text has
been removed.
After the assignment I can see in the debugger that one of the members
of the HtmlElement object (OffsetParent, I think) has a string
indicating some kind of COM Interop services exception.
Is it possible to change the HTML in a web page? Am I going about it
the wrong way? Is there some kind of initialization or setup call I am
supposed to make? Is it just a bug in .NET 2.0?
I am trying to programmatically select an item in a listbox on a web
page. The first thing I do is go through and de-select any selected
items. The OuterHtml field of a selected element in the listbox looks
something like this:
<OPTION value=* selected>Default item</OPTION>
I want to simply remove the the term 'selected' this way:
elt.OuterHtml = elt.OuterHtml.Replace("selected","");
This results in OuterHtml being set to:
<OPTION value=* selected></OPTION>
Notice: 1) the 'selected' term is untouched, 2) the visible text has
been removed.
After the assignment I can see in the debugger that one of the members
of the HtmlElement object (OffsetParent, I think) has a string
indicating some kind of COM Interop services exception.
Is it possible to change the HTML in a web page? Am I going about it
the wrong way? Is there some kind of initialization or setup call I am
supposed to make? Is it just a bug in .NET 2.0?