This is a migrated thread and some comments may be shown as answers.

Setting innerhtml of an item

3 Answers 693 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Jim
Top achievements
Rank 1
Jim asked on 03 Feb 2012, 12:35 PM
Article at
http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlcontainercontrol.innerhtml.aspx
suggests you can set the innerhtml of items

So I have

<telerik:RadDock ID="RadDock3" runat="server" Width="300px" Resizable="True" DockHandle="Grip">
    <ContentTemplate>
    <div>
    <span id="Message" runat="server">Hello World</span>
    </div>
    </ContentTemplate>
</telerik:RadDock>

In my code behind I have

 

 


Dim
myHtml As String = Message.InnerHtml

 


When I try to run it says build errors, but doesn't display any ??

Is getting and setting the innerhtml possible ?

Thanks
Jim






3 Answers, 1 is accepted

Sort by
0
Jim
Top achievements
Rank 1
answered on 03 Feb 2012, 12:46 PM
Hmmm very strange.
When it says build errors, if I say run anyway it does actually set the innerhtml.

Jim
0
Jim
Top achievements
Rank 1
answered on 03 Feb 2012, 01:11 PM
If I open my output window and the build I see

C:\Users\JimL\documents\visual studio 2010\Projects\DLXDockDemo\DLXDockDemo\Default.aspx.vb(37,0): error BC30451: 'Text1' is not declared. It may be inaccessible due to its protection level.

C:\Users\JimL\documents\visual studio 2010\Projects\DLXDockDemo\DLXDockDemo\Default.aspx.vb(38,0): error BC30451: 'Text2' is not declared. It may be inaccessible due to its protection level.

But Don't know why?
Jim

0
Jim
Top achievements
Rank 1
answered on 03 Feb 2012, 04:29 PM
Hmm Hmm Hmm
After much hair pulling I made a completly new VS project and copied my stuff over to that.
Works a treat.
It was some how connected with Telerik.Web.UI.xml
But I gave up trying to figure out why!
Once it worked my solution was
<telerik:RadDock ID="RadDock3" runat="server" Width="300px" Resizable="True" DockHandle="Grip">
    <ContentTemplate>
        <asp:Panel ID="myPanel1" runat="server">
            <span class="myStyle1" id="mySpan1" runat="server">My text line 1</span><br />
            <span class="myStyle2" id="mySpan2" runat="server">My text line 2</span><br />
        </asp:Panel>
    </ContentTemplate>
</telerik:RadDock>

with code behind
Dim mySpan1 As HtmlGenericControl = New HtmlGenericControl("Span")
mySpan1 = myPanel1.FindControl("mySpan1")
mySpan1.InnerHtml = "Hello"
mySpan2.InnerHtml = "from Jim"

And you can style the different spans with different font etc.
Thanks
Jim

Tags
General Discussions
Asked by
Jim
Top achievements
Rank 1
Answers by
Jim
Top achievements
Rank 1
Share this question
or