By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,188 Members | 834 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,188 IT Pros & Developers. It's quick & easy.

insert message with overrides

P: n/a
TJS
I want to insert a message with an override if a condition exists but the
overrides does not kick in.
How do I invoke the overrides to display a message from my class code?

============Overrides code================
Protected Overrides Sub Render(writer As HtmlTextWriter)

if Application("idx") = true then
Dim vMessage As String = "message goes here"

'*** Render the page and retrieve into StringBuilder
Dim sb As New StringBuilder()
Dim hWriter As New HtmlTextWriter(New StringWriter(sb))
MyBase.Render(hWriter)

' *** store to a string
Dim PageResult As String = sb.ToString()
Dim At As Integer = PageResult.ToLower().LastIndexOf("")

If At > - 1 Then
PageResult = PageResult.Insert(At, vMessage)
End If

' *** Write it back to the server
writer.Write(PageResult)
end if

Return

End Sub 'Render
Nov 18 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Hi

I assume the code that you have sent is of a custom control that you are trying to build

So as you know the custom controls gets bundled in to a separate Assembly and to use them you have to register the
in the page that you use it

So this assembly knows nothing of the HttpContext

Try doing out this

1> Include the namespace System.Web

2> When you want to access the Application variables use the following
HttpContext.Current.Application(VarName

i hope this should solve your problem

Let me know on this
Nov 18 '05 #2

P: n/a
TJS
it was the HttpContext thingy

thanks
"kashypa" <lo*****@aztec.soft.net> wrote in message
news:07**********************************@microsof t.com...
Hi,

I assume the code that you have sent is of a custom control that you are trying to build.
So as you know the custom controls gets bundled in to a separate Assembly and to use them you have to register them in the page that you use it.

So this assembly knows nothing of the HttpContext.

Try doing out this.

1> Include the namespace System.Web.

2> When you want to access the Application variables use the following
HttpContext.Current.Application(VarName)

i hope this should solve your problem.

Let me know on this

Nov 18 '05 #3

P: n/a
Hey

Thats good man

Happy that i could be of some help 2 u
Nov 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.