Ask a Question related to ASP.NET Building Controls, Design and Development.
-
dmitcha #1
WebChat - customizing code assistance from a NEEEEEEWBIE
Hi, I just added Steve Orr's incredible WebChat control to my page (ASP.NET
2.0), but I'm not advanced enough to correctly add the additional code for
filters and identifying the user (I used CreateUserWizard for secure log-in).
1) TEXT FILTER. What is the correct syntax for the Chatter event to filter
words? Here is the sample code Steve kindly supplied in his article:
Protected Sub WebChat1_Chatter(ByRef ChatText As String) _
Handles WebChat1.Chatter
'You can replace bad words...
ChatText = ChatText.Replace("hell", "h***")
'...or spruce things up with emoticons
ChatText = ChatText.Replace(":)", _
"<img src='smiley.jpg' title=':)' />")
End Sub
I have placed this in the Script section at the top. I, unfortunately, do
not know how to create a syntactically correct single list with many replace
requests, and my compiler keeps kicking up the "Handle..." line as a syntax
error.
2) LIVE COMMENT SUPERVISION. Is there a way to supervise content live to
prevent certain posts from ever posting and to even block users)?
3) USER ID. Where does the provided code snippet go for the UserName
property?
Here is Steve's starter snippet, but it doesn't seem to work inside of the
CC1 code, and if I try to add it as a Protected Sub in the Script, the
compiler says I need a declaration.
4) CHAT ROOM ACCESS TOGGLE. Is there code to allow the Webmaster to open
and close the Chat Room for use?
Thank you very much in advance for any assistance! So sorry for the
incredibly green questions. dma
dmitcha Guest
-
Customizing an Accordion
I am trying to figure out a way to customize an Accordion so that the VBoxes inside will remain open unless I click a triangle icon that I place on... -
customizing insert bar in DW 8
I am trying to customize the insert bar in DW8. I have editted the insertbar.xml file, but no changes seem to "take". In fact, I can delete the... -
Customizing Toolbar in MX
When I try to customize a toolbar in MX (running Panther), I can't remove buttons. I tried holding down the COMMAND key yet I still can't remove... -
Help! Dependent Lists with SQL Server (with code/db setup) assistance needed!
Hey folks, i'm _trying_ to get a dependent list box example working from this example/tutorial found at... -
Brute Force Quickie Developer needs minor assistance finding code tool . . .
Hello, I am new to Oracle. I've been programming various client and web based utilities for MS SQL for years, now we have an Oracle server and... -
Steve C. Orr [MVP, MCSD] #2
Re: WebChat - customizing code assistance from a NEEEEEEWBIE
I'm flattered you like WebChat so much.
The Handles statement should be on the same line as the sub declaration.
Try this code:
Protected Sub WebChat1_Chatter(ByRef ChatText As String) Handles WebChat1.Chatter
System.Diagnostics.Debug.WriteLine("Page detected chatter event from WebChat control")
'The page will not be rendered
'after this event since it's a callback
'but ChatText will be displayed in the WebChat control.
'So you can replace bad words...
ChatText = ChatText.Replace("hell", "h***")
'...or spruce things up with emoticons
ChatText = ChatText.Replace(":)", _
"<img src='smiley.jpg' title=':)' />")
End Sub
As for the optimal way to filter a variety of words, well that's up to you to decide since the control doesn't directly implement that. I might suggest using one or more regular expressions to do the work. You may be able to find some useful regular expressions from google in case you're not very experienced with them.
You can set the WebChat's username property from the page load event or pretty much wherever else you want in the code behind.
WebChat1.UserName = sName
There is not currently a live content supervision feature built directly into the control, but you should be able to build one in yourself since all chat content gets filtered through the Chatter event. You could hook into this event and do pretty much any kind of filtering or supervision you want.
--
I hope this helps,
Steve C. Orr, MCSD, MVP
[url]http://SteveOrr.net[/url]
"dmitcha" <dmitcha@discussions.microsoft.com> wrote in message news:3B60944F-C0A8-465D-9F22-17F0B4B4E55C@microsoft.com...> Hi, I just added Steve Orr's incredible WebChat control to my page (ASP.NET
> 2.0), but I'm not advanced enough to correctly add the additional code for
> filters and identifying the user (I used CreateUserWizard for secure log-in).
>
> 1) TEXT FILTER. What is the correct syntax for the Chatter event to filter
> words? Here is the sample code Steve kindly supplied in his article:
>
> Protected Sub WebChat1_Chatter(ByRef ChatText As String) _
>
> Handles WebChat1.Chatter
>
> 'You can replace bad words...
>
> ChatText = ChatText.Replace("hell", "h***")
>
> '...or spruce things up with emoticons
>
> ChatText = ChatText.Replace(":)", _
>
> "<img src='smiley.jpg' title=':)' />")
>
> End Sub
>
> I have placed this in the Script section at the top. I, unfortunately, do
> not know how to create a syntactically correct single list with many replace
> requests, and my compiler keeps kicking up the "Handle..." line as a syntax
> error.
>
> 2) LIVE COMMENT SUPERVISION. Is there a way to supervise content live to
> prevent certain posts from ever posting and to even block users)?
>
> 3) USER ID. Where does the provided code snippet go for the UserName
> property?
>
> Here is Steve's starter snippet, but it doesn't seem to work inside of the
> CC1 code, and if I try to add it as a Protected Sub in the Script, the
> compiler says I need a declaration.
>
> 4) CHAT ROOM ACCESS TOGGLE. Is there code to allow the Webmaster to open
> and close the Chat Room for use?
>
> Thank you very much in advance for any assistance! So sorry for the
> incredibly green questions. dmaSteve C. Orr [MVP, MCSD] Guest
-
dmitcha #3
RE: WebChat - customizing code assistance from a NEEEEEEWBIE
Well, I wasn't exactly expecting a response from you, yourself! Thank you
very much for the additional tips. Okay, going back in to try again. Please
be beyond flattered , Steve; I've been telling everyone today about this
amazing tool. You are BRILLIANT. dma
dmitcha Guest
-
dmitcha #4
Re: WebChat - customizing code assistance from a NEEEEEEWBIE
Thanks, again, Steve; I gave both a shot, and unfortunately, neither works as
a cut-and-paste. I'm not clear enough on Visual Basic .NET commands to
figure out why the syntax errors keep popping up. The debugger wants the
Handles clause to have a "WithEvents variable defined in the containing type
or one of its base types." And unfortunately, I am getting a similar error
when I try to set the property in the Page Load event.
It seems that there will need to be some kind of Dim statement for WebChat1
for me to proceed, but I'm not even sure what kind of information I'm
handling here...
I'm guessing my list of requests is not even an hour's worth of work for
someone with experience (if I can just get the syntax for the filter list, I
can party on from there); is there anyone who might be able to tweak this
script remotely for a Peet's online Coffee Card or PayPal payment? Thank
you! dma
<%@ Page Language="VB" MasterPageFile="~/homepage.master" Title="Hollywood
Calls—Home" %>
<script runat="server">
Protected Sub LoginView1_ViewChanged(ByVal sender As Object, ByVal e As
System.EventArgs)
End Sub
Protected Sub NewUserLinkButton_Click(ByVal sender As Object, ByVal e As
System.EventArgs)
End Sub
Protected Sub WebChat1_Chatter(ByRef ChatText As String) Handles
WebChat1.Chatter
System.Diagnostics.Debug.WriteLine("Page detected chatter event from
WebChat control")
'The page will not be rendered
'after this event since it's a callback
'but ChatText will be displayed in the WebChat control.
'So you can replace bad words...
ChatText = ChatText.Replace("hell", "h***")
'...or spruce things up with emoticons
ChatText = ChatText.Replace(":)", "<img src='smiley.jpg' title=':)'
/>")
End Sub
</script>
"Steve C. Orr [MVP, MCSD]" wrote:
> I'm flattered you like WebChat so much.
>
> The Handles statement should be on the same line as the sub declaration.
>
> Try this code:
>
> Protected Sub WebChat1_Chatter(ByRef ChatText As String) Handles WebChat1.Chatter
>
> System.Diagnostics.Debug.WriteLine("Page detected chatter event from WebChat control")
>
> 'The page will not be rendered
>
> 'after this event since it's a callback
>
> 'but ChatText will be displayed in the WebChat control.
>
> 'So you can replace bad words...
>
> ChatText = ChatText.Replace("hell", "h***")
>
> '...or spruce things up with emoticons
>
> ChatText = ChatText.Replace(":)", _
>
> "<img src='smiley.jpg' title=':)' />")
>
> End Sub
>
> As for the optimal way to filter a variety of words, well that's up to you to decide since the control doesn't directly implement that. I might suggest using one or more regular expressions to do the work. You may be able to find some useful regular expressions from google in case you're not very experienced with them.
>
> You can set the WebChat's username property from the page load event or pretty much wherever else you want in the code behind.
> WebChat1.UserName = sName
>
> There is not currently a live content supervision feature built directly into the control, but you should be able to build one in yourself since all chat content gets filtered through the Chatter event. You could hook into this event and do pretty much any kind of filtering or supervision you want.
>
>
> --
> I hope this helps,
> Steve C. Orr, MCSD, MVP
> [url]http://SteveOrr.net[/url]
>
>
>
> "dmitcha" <dmitcha@discussions.microsoft.com> wrote in message news:3B60944F-C0A8-465D-9F22-17F0B4B4E55C@microsoft.com...> > Hi, I just added Steve Orr's incredible WebChat control to my page (ASP.NET
> > 2.0), but I'm not advanced enough to correctly add the additional code for
> > filters and identifying the user (I used CreateUserWizard for secure log-in).
> >
> > 1) TEXT FILTER. What is the correct syntax for the Chatter event to filter
> > words? Here is the sample code Steve kindly supplied in his article:
> >
> > Protected Sub WebChat1_Chatter(ByRef ChatText As String) _
> >
> > Handles WebChat1.Chatter
> >
> > 'You can replace bad words...
> >
> > ChatText = ChatText.Replace("hell", "h***")
> >
> > '...or spruce things up with emoticons
> >
> > ChatText = ChatText.Replace(":)", _
> >
> > "<img src='smiley.jpg' title=':)' />")
> >
> > End Sub
> >
> > I have placed this in the Script section at the top. I, unfortunately, do
> > not know how to create a syntactically correct single list with many replace
> > requests, and my compiler keeps kicking up the "Handle..." line as a syntax
> > error.
> >
> > 2) LIVE COMMENT SUPERVISION. Is there a way to supervise content live to
> > prevent certain posts from ever posting and to even block users)?
> >
> > 3) USER ID. Where does the provided code snippet go for the UserName
> > property?
> >
> > Here is Steve's starter snippet, but it doesn't seem to work inside of the
> > CC1 code, and if I try to add it as a Protected Sub in the Script, the
> > compiler says I need a declaration.
> >
> > 4) CHAT ROOM ACCESS TOGGLE. Is there code to allow the Webmaster to open
> > and close the Chat Room for use?
> >
> > Thank you very much in advance for any assistance! So sorry for the
> > incredibly green questionsdmitcha Guest



Reply With Quote

