473,698 Members | 2,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

insert message with overrides

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?

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

if Application("id x") = 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(h Writer)

' *** store to a string
Dim PageResult As String = sb.ToString()
Dim At As Integer = PageResult.ToLo wer().LastIndex Of("")

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

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

Return

End Sub 'Render
Nov 18 '05 #1
3 1116
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.Cur rent.Applicatio n(VarName

i hope this should solve your problem

Let me know on this
Nov 18 '05 #2
TJS
it was the HttpContext thingy

thanks
"kashypa" <lo*****@aztec. soft.net> wrote in message
news:07******** *************** ***********@mic rosoft.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.Cur rent.Applicatio n(VarName)

i hope this should solve your problem.

Let me know on this

Nov 18 '05 #3
Hey

Thats good man

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

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2100
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional) arguments, such as: FirstClass Public Sub Populate(string) Public Sub Populate(string, string) I don't have to use Overloads, because both methods are in the same class.
5
11038
by: Rick Spiewak | last post by:
I need to generate a "buy" button as part of an ASP.NET page - this consists of a small HTML form with hidden fields, conforming to the requirements of a merchant credit card processor. PayPal is similar. I'm succeeding in doing this by using Writer.Write to emit my HTML, at least as far as getting it to work. However, depending on where I put MyBase.Render(Writer), I get my HTML either before the header or after the end of the body of...
9
12613
by: Surrealist | last post by:
I need something likes as when I create an event procedure. I can use top-left and top-right dropdown list of code editor to select object and its exposed events respectively. Then, the IDE, automatically paste the function header (signature) for me. But I can't find a way to see list of Sub or Function that I can overrides such as ToString Function.
10
13787
by: Atif | last post by:
Hi I am here to solve a small confusion i have in "Overloads Overrides". "Overloading" says that the method's name should be same while no. of parameters and/or their datatypes should be changed either in the same class or inherited class. right? "Overriding" says that the method's signature should be same(name,no. of parameters and their datatypes) in the inherited class while implementation may change. right?
2
2223
by: Kalvin | last post by:
I found some code in Google, don't remember where, for an AutoComplete combobox. Everything is great with it except for one thing. If I use the mouse to drop the list down, then start typing to find the item in the list, the visible text changes, but the values of me.Text and Mybase.Text do not change. If you use the mouse and actually click on the item, the values of me.text and Mybase.Text will change. Or, if you use the enter key to...
2
4316
by: Not Me | last post by:
Hi, I've seen this prob in a few places but the explanations/solution wasn't up to my understanding! I have a detailsview, with an insert button that works fine when there is already data in the bound datasource, but it appears blank otherwise. One solution was to make all fields templatefields, with itemtemplate and insertitemtemplate for each field. This didn't appear to change
1
3106
by: Pieter | last post by:
Hi, I have a custom List that inherits from BindingList. It has some methods overloaded, like the Add/Insert/etc to add and remove some eventhandlers when adding or removing an item T of the list. The problem happens when: - I use such a BindingList as DataSource for a BindingSource. - Add this BindingSource as DataSource for a DataGridView. - And go to the NewRow and add a new row in the DataGridView.
5
1469
by: J055 | last post by:
Hi How do I keep the values of the controls in a FormView after a PostBack in Insert mode? Thanks Andrew
0
2443
by: =?Utf-8?B?ZWQ=?= | last post by:
I had this exact problem using a vb.net client accessing a Java web service. The solution takes 3 steps: 1.) Create custom ClientOutputFilter 2.) Create a custom Assertion that uses filter from step 1 3.) Bind service to custom Assertion Step 1 Custom Filter(Called by Custom Assertion) Class ClientOutputFilter
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8899
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.