Thursday, March 29, 2012

Please change my readonly (Enabled=false) checkbox style as it is difficult to read.

Hi,

This has been bugging me for a while so any help is appreciated.

How do I change the style of a readonly checkbox? (i.e. Enabled = False) - it's very difficult to read

I am displaying a set of checkbox based on some database query which works fine - however the faded checkbox and tick are not easy to see. I don't want to use skin files/themes if I can help it.

The only option I can think of is to display the database results (1 or 0) as images (1 for empty checkbox and 1 for full checkbox) but it seems a bit over the top.

I may be missing something simple but I have tried various checkbox parameter settings to no avail.

Many thanks

MrCadburysParrot

I had the same concern and I wound up using images. Over the top? That's all I could get working...

 <asp:TemplateField HeaderText="Freeze Definition" SortExpression="FreezeDefn"> <ItemTemplate> <asp:Image ImageUrl="../../images/CheckBoxYes.gif" ID="imgFreezeDefnTrue" runat="server" Visible='<%# Convert.ToBoolean(Eval("FreezeDefn"))%>'> </asp:Image> <asp:Image ImageUrl="../../images/CheckBoxNo.gif" ID="imgFreezeDefnFalse" runat="server" Visible='<%# !Convert.ToBoolean(Eval("FreezeDefn"))%>'> </asp:Image> </ItemTemplate> <EditItemTemplate> <asp:CheckBox ID="cbxFreezeDefn" runat="server" checked='<%# Convert.ToBoolean(Eval("FreezeDefn"))%>'> </asp:CheckBox> </EditItemTemplate> <FooterTemplate> <asp:CheckBox ID="cbxNewFreezeDefn" runat="server" > </asp:CheckBox> </FooterTemplate> <ItemStyle HorizontalAlign="Center" /> <HeaderStyle HorizontalAlign="Center" Width="120px" Wrap="True" /> <FooterStyle HorizontalAlign="Center" /> </asp:TemplateField>

Hi,

Thanks for the response. It does seem the only way to do it. I ended up using

<asp:ImageID="chkD7Adjusted"runat="server"ImageUrl='<%# DisplayCheckGraphic(Eval("Interlocks")) %>'/>

The function DisplayCheckGraphic then returns a string value (depending on the Interlocks value) denoting the appropriate Image URL.

I'll leave the post running for a few days to see if anyone has a direct answer to the checkbox issue - if not I will allocate your response as the answer as it was same as the method that I am currently using.

Thanks

MrCadburysParrot


You can do many things such as setting style etc around it.

one way is to

Get the checked event in javascript and then

e.ParentNode.style.border =(e.checked ? 'outset' :' ' );

or for a simple readonly setting its style to outset, so that it becomes raised.


Yeah, you could stick it on the stylesheet too. That would be much neater. I'm not a designer though so I don't do much with styles beyong making something readable. I really would like to put some time into sexy-ing up my pages but I'm too busy developing functionality and working on ETL and such. So is everyone else on the team - the guy with the design skills is busy writing code generators.

Plus I can't stand CSS language. Why is it different than the syntax used for styles in ASP? The don't even have the same attributes... grr. Does silverlight encapsulate this kind of stuff by any chance? Is there something on the horizon that will give us a styling GUI? Thanks.


Charles Asbornsen:

Yeah, you could stick it on the stylesheet too. That would be much neater. I'm not a designer though so I don't do much with styles beyong making something readable. I really would like to put some time into sexy-ing up my pages but I'm too busy developing functionality and working on ETL and such. So is everyone else on the team - the guy with the design skills is busy writing code generators.

Plus I can't stand CSS language. Why is it different than the syntax used for styles in ASP? The don't even have the same attributes... grr. Does silverlight encapsulate this kind of stuff by any chance? Is there something on the horizon that will give us a styling GUI? Thanks.

Charles

CSS is a standard and rather a markup where as Asp.net is a framework and CSS existed way before Asp.net and imagine sugar and water cannot be same thing, however sugar provides sweetness to water. Silverlight is imagine a plugin like flash and CSS will still be at play. Yes there are skins but they also work with cSS.

Best regards


A poetic allusion for a buggering annoyance. Big Smile I appreciate the "objectiness" of CSS (kind of like truthiness), and I'd like to go through all my code and CSS the whole works, but that has to wait until all our deliverables are, um, delivered. I could really use some CSS training. I just wish I could go to something like powerpoint, draw my styled control in that, and then say "hey you, this is your style when selected, and this is your style when mouseover" and so forth without 28 lines of code...

Please clarify how null nodeset result processes?

Hi, I continue to have trouble with this. Using the following xml
sample:

<Station name="Station1" line_stop="yes"/
OR when NO line_stop attribute exists.

In asp.net page, I use xpath to determine IF the line_stop attribute
exists (or am TRYING to!)

Dim xDoc as XmlDocument
Dim xNode As XmlElement =
xDoc.SelectSingleNode("//Station[@dotnet.itags.org.name='Station1'][@dotnet.itags.org.line_stop='yes']")

If Not xNode.Value Is Nothing Then
If xNode.Value = "yes" Then
do this...
End If
End If

If there is no line_stop attribute, I get an error for "Object reference
not set to an instance of an object" at the If Not xNode.Value
line...obviously returning no node.

Please tell me where I'm going wrong.

Thanks,
Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!Kathy, you might get better responses in the .framework group, since this
doesn't seem to be specific to ASP.NET.

--
John Saunders
Internet Engineer
john.saunders@.surfcontrol.com

"Kathy Burke" <kathyburke40@.attbi.com> wrote in message
news:%23xJL5a0aDHA.2412@.TK2MSFTNGP10.phx.gbl...
> Hi, I continue to have trouble with this. Using the following xml
> sample:
> <Station name="Station1" line_stop="yes"/>
> OR when NO line_stop attribute exists.
> In asp.net page, I use xpath to determine IF the line_stop attribute
> exists (or am TRYING to!)
> Dim xDoc as XmlDocument
> Dim xNode As XmlElement =
> xDoc.SelectSingleNode("//Station[@.name='Station1'][@.line_stop='yes']")
> If Not xNode.Value Is Nothing Then
> If xNode.Value = "yes" Then
> do this...
> End If
> End If
> If there is no line_stop attribute, I get an error for "Object reference
> not set to an instance of an object" at the If Not xNode.Value
> line...obviously returning no node.
> Please tell me where I'm going wrong.
> Thanks,
> Kathy
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
check if the xNode is nothing first

"Kathy Burke" <kathyburke40@.attbi.com> wrote in message
news:%23xJL5a0aDHA.2412@.TK2MSFTNGP10.phx.gbl...
> Hi, I continue to have trouble with this. Using the following xml
> sample:
> <Station name="Station1" line_stop="yes"/>
> OR when NO line_stop attribute exists.
> In asp.net page, I use xpath to determine IF the line_stop attribute
> exists (or am TRYING to!)
> Dim xDoc as XmlDocument
> Dim xNode As XmlElement =
> xDoc.SelectSingleNode("//Station[@.name='Station1'][@.line_stop='yes']")
> If Not xNode.Value Is Nothing Then
> If xNode.Value = "yes" Then
> do this...
> End If
> End If
> If there is no line_stop attribute, I get an error for "Object reference
> not set to an instance of an object" at the If Not xNode.Value
> line...obviously returning no node.
> Please tell me where I'm going wrong.
> Thanks,
> Kathy
> *** Sent via Developersdex http://www.developersdex.com ***
> Don't just participate in USENET...get rewarded for it!
Doesn't "If Not xNode.Value Is Nothing Then" check that xNode is
nothing?

Thanks.

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
"Kathy Burke" <kathyburke40@.attbi.com> wrote in message
news:ei17Bx0aDHA.2024@.TK2MSFTNGP12.phx.gbl...
> Doesn't "If Not xNode.Value Is Nothing Then" check that xNode is
> nothing?

No. That checks to see if xNode.Value is Nothing. If xNode is Nothing, the
above "If" statement will throw a NullReferenceException.

To see if xNode is Nothing try:

If Not xNode is Nothing Then

--
John Saunders
Internet Engineer
john.saunders@.surfcontrol.com
Hi again,

I've tried adding:

If Not n16 Is Nothing Then
If n16.Value = "yes" Then
Dim strNext As String = "yes"
End If
End If

but still get a NullReferenceException on the first line of the above
snippet. In this particular case, I SHOULD get "nothing" as a result
since the attribute 'line_stop' doesn't exist for the element
selected...but the code should then continue, yes?

Any suggestions for how I can proceed?

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Please check....~~

My friend wrote me an asp mail, it's written for a flash mail, but the mail cant be deliver to mailbox...can you help me check that is there any errors in this asp form? Thxxx

<%
On Error resume Next
Dim TBdy
Dim MyCDO
CR = Chr(13)
Set MyCDO = Server.CreateObject("CDONTS.NewMail")
If IsObject (MyCDO) Then
MyCDO.From = Request("email")
MyCDO.To = "mymail@dotnet.itags.org.abc.com"
MyCDO.Subject = "Contact Form"
TBdy = "Name: " & Request("name") & CR
TBdy = TBdy & "Contact Number: " & Request("contact") & CR
TBdy = TBdy & "Company Name: " & Request("company") & CR
TBdy = TBdy & "Company Address: " & Request("address") & CR
TBdy = TBdy & "City: " & Request("city") & CR
TBdy = TBdy & "Postcode: " & Request("postcode") & CR
TBdy = TBdy & "Country: " & Request("country") & CR
TBdy = TBdy & "Enquiry About: " & Request("enquiry") & CR
TBdy = TBdy & "Contact Email: " & Request("email") & CR
TBdy = TBdy & "Enquiry/Comment: " & Request("comment")
MyCDO.Body = TBdy
MyCDO.Importance = 2 (High)
MyCDO.Send
Set MyCDO = nothing
Response.Write("&bool=success&")
Else
Response.Write("&bool=failed&")
End If
%>Welcome to the ASP.NET Forums, bunko.

However, you are in the wrong place. These forums are for developers using ASP.NET.

As you are using classic ASP, you need to direct all your questions to theASP Messageboard.
oopppssss...sorrie... wrong place.. :p

please check this link http://www.kerala.bsnl.co.in/newdqasp/newdq1.asp

http://www.kerala.bsnl.co.in/newdqasp/newdq1.asp

when the mouse is over the thariff menu the menu will be listed but the drop down list is just over the menu any solutions to solve this..

are you saying you want the popupmenu to appear slightly lower? It looks like when the mouse goes over the menu item a function call MM_ShowMenu is called and this takes coordinates for where to display the menu. Try changing

<A id=link14 onmouseout=MM_startTimeout();
onmouseover="MM_showMenu(window.mm_menu_0611164247_0,0,16,null,'link15')"
name=link15>TARIFF</A>

To

<A id=link14 onmouseout=MM_startTimeout();
onmouseover="MM_showMenu(window.mm_menu_0611164247_0,0,25,null,'link15')"
name=link15>TARIFF</A>

Not really sure what it will do as I'm unable to test it here but give it a go.


i wanted the menu to be on top of dropdown list insted of showing the dropdown list betwen the menu.


Hi,

I notice something abt the site... When u click the dropdownlist and dun select anything, then mouse to ur menu the dropdownlist still appear... Which dun look gd


what should i do to overcome this problem

Please check code - need to make generic

Hello -
This code was snagged by me from the Internet and altered. Its purpose is
to check for swear words. It works the way it currently is, but I need it t
o
be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
directly; I want to be able to plug in the name of any textbox into
CheckString(TextBox1.Text), instead of just a specific textbox. [I have man
y
textboxes on one page that all need to be checked.]
Public Sub CheckString(inputstring as string)
Dim alWordList as New ArrayList
Dim origtext as String
origtext = TextBox1.Text
dim xmlDocPath as string = server.mappath("bad_words2.xml")
dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
While (xmlReader.Read())
if xmlReader.Nodetype=xmlNodeType.Text then
alWordList.Add(xmlReader.Value)
End If
End While
xmlReader.Close()
Dim r as Regex
dim element as string
dim output as string
For Each element in alWordList
r = New Regex("\b" & element)
InputString = r.Replace(InputString, "****")
Next
TextBox1.Text = InputString
If origtext <> TextBox1.Text Then
Label1.Text = "Funky words, please replace."
Else
Label1.Text = "Okay." 'This is just included for testing
End If
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckString(TextBox1.Text)
End Sub
Any suggestions will be greatly appreciated!
--
SandyHi Sandy,
You can try
Public Sub CheckString(txtBox As TextBox, lbl As Label)
Dim alWordList as New ArrayList
Dim inputstring as string = txtBox.Text
Dim origtext as String = inputstring
dim xmlDocPath as string = server.mappath("bad_words2.xml")
dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
While (xmlReader.Read())
if xmlReader.Nodetype=xmlNodeType.Text then
alWordList.Add(xmlReader.Value)
End If
End While
xmlReader.Close()
Dim r as Regex
dim element as string
dim output as string
For Each element in alWordList
r = New Regex("\b" & element)
inputString = r.Replace(inputString, "****")
Next
txtBox.Text = inputString
If Not origtext.Equals(inputString) Then
lbl.Text = "Funky words, please replace."
Else
lbl.Text = "Okay." 'This is just included for testing
End If
End Sub
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckString(TextBox1, Label1)
End Sub
"Sandy" wrote:

> Hello -
> This code was snagged by me from the Internet and altered. Its purpose is
> to check for swear words. It works the way it currently is, but I need it
to
> be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I have m
any
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
You could achieve this by e.g. creating a new class with a static
method called
public static bool CheckString( string input, string censoredString )
that returns a bool indicating whether it had to censor the string.
The censored string is written into the second string reference you
pass.
Since I am not familiar with VB, here is the C# for that.
public class SwearWordChecker{
public static string CheckString( string input, string censoredString
){
censoredString = input;
// do your thing here
..
censoredString = r.Replace(InputString, "****");
..
//if they are the same, return true
return (input == censoredString);
}
}
and then use that class in your Button code:
Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
string censored = null;
if( !CheckString(TextBox1.Text, censored) ){
TextBox1.Text = censored;
lblError.Text = "You cursing sombitch."
}
End Sub
Hope this helps.
Manuel
Sandy wrote:
> Hello -
> This code was snagged by me from the Internet and altered. Its
purpose is
> to check for swear words. It works the way it currently is, but I
need it to
> be more generic -- i.e., I don't want it to refer to TextBox1 or
Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I
have many
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
Thanks so much, Elton. It works beautifully!
Sandy
"Elton W" wrote:
> Hi Sandy,
> You can try
> Public Sub CheckString(txtBox As TextBox, lbl As Label)
> Dim alWordList as New ArrayList
> Dim inputstring as string = txtBox.Text
> Dim origtext as String = inputstring
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> inputString = r.Replace(inputString, "****")
> Next
> txtBox.Text = inputString
> If Not origtext.Equals(inputString) Then
> lbl.Text = "Funky words, please replace."
> Else
> lbl.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1, Label1)
> End Sub
>
> "Sandy" wrote:
>
Thanks for your response!
Sandy
"DoesDotNet" wrote:

> You could achieve this by e.g. creating a new class with a static
> method called
> public static bool CheckString( string input, string censoredString )
> that returns a bool indicating whether it had to censor the string.
> The censored string is written into the second string reference you
> pass.
> Since I am not familiar with VB, here is the C# for that.
> public class SwearWordChecker{
> public static string CheckString( string input, string censoredString
> ){
> censoredString = input;
> // do your thing here
> ...
> censoredString = r.Replace(InputString, "****");
> ...
> //if they are the same, return true
> return (input == censoredString);
> }
> }
> and then use that class in your Button code:
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> string censored = null;
> if( !CheckString(TextBox1.Text, censored) ){
> TextBox1.Text = censored;
> lblError.Text = "You cursing sombitch."
> }
> End Sub
> Hope this helps.
> Manuel
>
> Sandy wrote:
> purpose is
> need it to
> Label1
> have many
>

Please check code - need to make generic

Hello -

This code was snagged by me from the Internet and altered. Its purpose is
to check for swear words. It works the way it currently is, but I need it to
be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
directly; I want to be able to plug in the name of any textbox into
CheckString(TextBox1.Text), instead of just a specific textbox. [I have many
textboxes on one page that all need to be checked.]

Public Sub CheckString(inputstring as string)
Dim alWordList as New ArrayList

Dim origtext as String
origtext = TextBox1.Text

dim xmlDocPath as string = server.mappath("bad_words2.xml")
dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
While (xmlReader.Read())
if xmlReader.Nodetype=xmlNodeType.Text then
alWordList.Add(xmlReader.Value)
End If
End While
xmlReader.Close()

Dim r as Regex
dim element as string
dim output as string
For Each element in alWordList
r = New Regex("\b" & element)
InputString = r.Replace(InputString, "****")
Next

TextBox1.Text = InputString
If origtext <> TextBox1.Text Then
Label1.Text = "Funky words, please replace."
Else
Label1.Text = "Okay." 'This is just included for testing
End If
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckString(TextBox1.Text)
End Sub

Any suggestions will be greatly appreciated!
--
SandyHi Sandy,

You can try

Public Sub CheckString(txtBox As TextBox, lbl As Label)
Dim alWordList as New ArrayList
Dim inputstring as string = txtBox.Text
Dim origtext as String = inputstring

dim xmlDocPath as string = server.mappath("bad_words2.xml")
dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
While (xmlReader.Read())
if xmlReader.Nodetype=xmlNodeType.Text then
alWordList.Add(xmlReader.Value)
End If
End While
xmlReader.Close()

Dim r as Regex
dim element as string
dim output as string
For Each element in alWordList
r = New Regex("\b" & element)
inputString = r.Replace(inputString, "****")
Next

txtBox.Text = inputString
If Not origtext.Equals(inputString) Then
lbl.Text = "Funky words, please replace."
Else
lbl.Text = "Okay." 'This is just included for testing
End If
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckString(TextBox1, Label1)
End Sub

"Sandy" wrote:

> Hello -
> This code was snagged by me from the Internet and altered. Its purpose is
> to check for swear words. It works the way it currently is, but I need it to
> be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I have many
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
Hi Sandy,

You can try

Public Sub CheckString(txtBox As TextBox, lbl As Label)
Dim alWordList as New ArrayList
Dim inputstring as string = txtBox.Text
Dim origtext as String = inputstring

dim xmlDocPath as string = server.mappath("bad_words2.xml")
dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
While (xmlReader.Read())
if xmlReader.Nodetype=xmlNodeType.Text then
alWordList.Add(xmlReader.Value)
End If
End While
xmlReader.Close()

Dim r as Regex
dim element as string
dim output as string
For Each element in alWordList
r = New Regex("\b" & element)
inputString = r.Replace(inputString, "****")
Next

txtBox.Text = inputString
If Not origtext.Equals(inputString) Then
lbl.Text = "Funky words, please replace."
Else
lbl.Text = "Okay." 'This is just included for testing
End If
End Sub

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
CheckString(TextBox1, Label1)
End Sub

"Sandy" wrote:

> Hello -
> This code was snagged by me from the Internet and altered. Its purpose is
> to check for swear words. It works the way it currently is, but I need it to
> be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I have many
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
You could achieve this by e.g. creating a new class with a static
method called

public static bool CheckString( string input, string censoredString )

that returns a bool indicating whether it had to censor the string.
The censored string is written into the second string reference you
pass.
Since I am not familiar with VB, here is the C# for that.

public class SwearWordChecker{
public static string CheckString( string input, string censoredString
){
censoredString = input;
// do your thing here
...
censoredString = r.Replace(InputString, "****");
...
//if they are the same, return true
return (input == censoredString);
}
}

and then use that class in your Button code:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
string censored = null;
if( !CheckString(TextBox1.Text, censored) ){
TextBox1.Text = censored;
lblError.Text = "You cursing sombitch."
}
End Sub

Hope this helps.
Manuel

Sandy wrote:
> Hello -
> This code was snagged by me from the Internet and altered. Its
purpose is
> to check for swear words. It works the way it currently is, but I
need it to
> be more generic -- i.e., I don't want it to refer to TextBox1 or
Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I
have many
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
You could achieve this by e.g. creating a new class with a static
method called

public static bool CheckString( string input, string censoredString )

that returns a bool indicating whether it had to censor the string.
The censored string is written into the second string reference you
pass.
Since I am not familiar with VB, here is the C# for that.

public class SwearWordChecker{
public static string CheckString( string input, string censoredString
){
censoredString = input;
// do your thing here
...
censoredString = r.Replace(InputString, "****");
...
//if they are the same, return true
return (input == censoredString);
}
}

and then use that class in your Button code:

Private Sub Button1_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.Click
string censored = null;
if( !CheckString(TextBox1.Text, censored) ){
TextBox1.Text = censored;
lblError.Text = "You cursing sombitch."
}
End Sub

Hope this helps.
Manuel

Sandy wrote:
> Hello -
> This code was snagged by me from the Internet and altered. Its
purpose is
> to check for swear words. It works the way it currently is, but I
need it to
> be more generic -- i.e., I don't want it to refer to TextBox1 or
Label1
> directly; I want to be able to plug in the name of any textbox into
> CheckString(TextBox1.Text), instead of just a specific textbox. [I
have many
> textboxes on one page that all need to be checked.]
> Public Sub CheckString(inputstring as string)
> Dim alWordList as New ArrayList
> Dim origtext as String
> origtext = TextBox1.Text
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> InputString = r.Replace(InputString, "****")
> Next
> TextBox1.Text = InputString
> If origtext <> TextBox1.Text Then
> Label1.Text = "Funky words, please replace."
> Else
> Label1.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1.Text)
> End Sub
> Any suggestions will be greatly appreciated!
> --
> Sandy
Thanks so much, Elton. It works beautifully!

Sandy

"Elton W" wrote:

> Hi Sandy,
> You can try
> Public Sub CheckString(txtBox As TextBox, lbl As Label)
> Dim alWordList as New ArrayList
> Dim inputstring as string = txtBox.Text
> Dim origtext as String = inputstring
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> inputString = r.Replace(inputString, "****")
> Next
> txtBox.Text = inputString
> If Not origtext.Equals(inputString) Then
> lbl.Text = "Funky words, please replace."
> Else
> lbl.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1, Label1)
> End Sub
>
> "Sandy" wrote:
> > Hello -
> > This code was snagged by me from the Internet and altered. Its purpose is
> > to check for swear words. It works the way it currently is, but I need it to
> > be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
> > directly; I want to be able to plug in the name of any textbox into
> > CheckString(TextBox1.Text), instead of just a specific textbox. [I have many
> > textboxes on one page that all need to be checked.]
> > Public Sub CheckString(inputstring as string)
> > Dim alWordList as New ArrayList
> > Dim origtext as String
> > origtext = TextBox1.Text
> > dim xmlDocPath as string = server.mappath("bad_words2.xml")
> > dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> > While (xmlReader.Read())
> > if xmlReader.Nodetype=xmlNodeType.Text then
> > alWordList.Add(xmlReader.Value)
> > End If
> > End While
> > xmlReader.Close()
> > Dim r as Regex
> > dim element as string
> > dim output as string
> > For Each element in alWordList
> > r = New Regex("\b" & element)
> > InputString = r.Replace(InputString, "****")
> > Next
> > TextBox1.Text = InputString
> > If origtext <> TextBox1.Text Then
> > Label1.Text = "Funky words, please replace."
> > Else
> > Label1.Text = "Okay." 'This is just included for testing
> > End If
> > End Sub
> > Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > CheckString(TextBox1.Text)
> > End Sub
> > Any suggestions will be greatly appreciated!
> > --
> > Sandy
Thanks so much, Elton. It works beautifully!

Sandy

"Elton W" wrote:

> Hi Sandy,
> You can try
> Public Sub CheckString(txtBox As TextBox, lbl As Label)
> Dim alWordList as New ArrayList
> Dim inputstring as string = txtBox.Text
> Dim origtext as String = inputstring
> dim xmlDocPath as string = server.mappath("bad_words2.xml")
> dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> While (xmlReader.Read())
> if xmlReader.Nodetype=xmlNodeType.Text then
> alWordList.Add(xmlReader.Value)
> End If
> End While
> xmlReader.Close()
> Dim r as Regex
> dim element as string
> dim output as string
> For Each element in alWordList
> r = New Regex("\b" & element)
> inputString = r.Replace(inputString, "****")
> Next
> txtBox.Text = inputString
> If Not origtext.Equals(inputString) Then
> lbl.Text = "Funky words, please replace."
> Else
> lbl.Text = "Okay." 'This is just included for testing
> End If
> End Sub
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> CheckString(TextBox1, Label1)
> End Sub
>
> "Sandy" wrote:
> > Hello -
> > This code was snagged by me from the Internet and altered. Its purpose is
> > to check for swear words. It works the way it currently is, but I need it to
> > be more generic -- i.e., I don't want it to refer to TextBox1 or Label1
> > directly; I want to be able to plug in the name of any textbox into
> > CheckString(TextBox1.Text), instead of just a specific textbox. [I have many
> > textboxes on one page that all need to be checked.]
> > Public Sub CheckString(inputstring as string)
> > Dim alWordList as New ArrayList
> > Dim origtext as String
> > origtext = TextBox1.Text
> > dim xmlDocPath as string = server.mappath("bad_words2.xml")
> > dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> > While (xmlReader.Read())
> > if xmlReader.Nodetype=xmlNodeType.Text then
> > alWordList.Add(xmlReader.Value)
> > End If
> > End While
> > xmlReader.Close()
> > Dim r as Regex
> > dim element as string
> > dim output as string
> > For Each element in alWordList
> > r = New Regex("\b" & element)
> > InputString = r.Replace(InputString, "****")
> > Next
> > TextBox1.Text = InputString
> > If origtext <> TextBox1.Text Then
> > Label1.Text = "Funky words, please replace."
> > Else
> > Label1.Text = "Okay." 'This is just included for testing
> > End If
> > End Sub
> > Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > CheckString(TextBox1.Text)
> > End Sub
> > Any suggestions will be greatly appreciated!
> > --
> > Sandy
Thanks for your response!

Sandy

"DoesDotNet" wrote:

> You could achieve this by e.g. creating a new class with a static
> method called
> public static bool CheckString( string input, string censoredString )
> that returns a bool indicating whether it had to censor the string.
> The censored string is written into the second string reference you
> pass.
> Since I am not familiar with VB, here is the C# for that.
> public class SwearWordChecker{
> public static string CheckString( string input, string censoredString
> ){
> censoredString = input;
> // do your thing here
> ...
> censoredString = r.Replace(InputString, "****");
> ...
> //if they are the same, return true
> return (input == censoredString);
> }
> }
> and then use that class in your Button code:
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> string censored = null;
> if( !CheckString(TextBox1.Text, censored) ){
> TextBox1.Text = censored;
> lblError.Text = "You cursing sombitch."
> }
> End Sub
> Hope this helps.
> Manuel
>
> Sandy wrote:
> > Hello -
> > This code was snagged by me from the Internet and altered. Its
> purpose is
> > to check for swear words. It works the way it currently is, but I
> need it to
> > be more generic -- i.e., I don't want it to refer to TextBox1 or
> Label1
> > directly; I want to be able to plug in the name of any textbox into
> > CheckString(TextBox1.Text), instead of just a specific textbox. [I
> have many
> > textboxes on one page that all need to be checked.]
> > Public Sub CheckString(inputstring as string)
> > Dim alWordList as New ArrayList
> > Dim origtext as String
> > origtext = TextBox1.Text
> > dim xmlDocPath as string = server.mappath("bad_words2.xml")
> > dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> > While (xmlReader.Read())
> > if xmlReader.Nodetype=xmlNodeType.Text then
> > alWordList.Add(xmlReader.Value)
> > End If
> > End While
> > xmlReader.Close()
> > Dim r as Regex
> > dim element as string
> > dim output as string
> > For Each element in alWordList
> > r = New Regex("\b" & element)
> > InputString = r.Replace(InputString, "****")
> > Next
> > TextBox1.Text = InputString
> > If origtext <> TextBox1.Text Then
> > Label1.Text = "Funky words, please replace."
> > Else
> > Label1.Text = "Okay." 'This is just included for testing
> > End If
> > End Sub
> > Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > CheckString(TextBox1.Text)
> > End Sub
> > Any suggestions will be greatly appreciated!
> > --
> > Sandy
>
Thanks for your response!

Sandy

"DoesDotNet" wrote:

> You could achieve this by e.g. creating a new class with a static
> method called
> public static bool CheckString( string input, string censoredString )
> that returns a bool indicating whether it had to censor the string.
> The censored string is written into the second string reference you
> pass.
> Since I am not familiar with VB, here is the C# for that.
> public class SwearWordChecker{
> public static string CheckString( string input, string censoredString
> ){
> censoredString = input;
> // do your thing here
> ...
> censoredString = r.Replace(InputString, "****");
> ...
> //if they are the same, return true
> return (input == censoredString);
> }
> }
> and then use that class in your Button code:
> Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> System.EventArgs) Handles Button1.Click
> string censored = null;
> if( !CheckString(TextBox1.Text, censored) ){
> TextBox1.Text = censored;
> lblError.Text = "You cursing sombitch."
> }
> End Sub
> Hope this helps.
> Manuel
>
> Sandy wrote:
> > Hello -
> > This code was snagged by me from the Internet and altered. Its
> purpose is
> > to check for swear words. It works the way it currently is, but I
> need it to
> > be more generic -- i.e., I don't want it to refer to TextBox1 or
> Label1
> > directly; I want to be able to plug in the name of any textbox into
> > CheckString(TextBox1.Text), instead of just a specific textbox. [I
> have many
> > textboxes on one page that all need to be checked.]
> > Public Sub CheckString(inputstring as string)
> > Dim alWordList as New ArrayList
> > Dim origtext as String
> > origtext = TextBox1.Text
> > dim xmlDocPath as string = server.mappath("bad_words2.xml")
> > dim xmlReader as XmlTextreader = New xmlTextReader(xmlDocPath)
> > While (xmlReader.Read())
> > if xmlReader.Nodetype=xmlNodeType.Text then
> > alWordList.Add(xmlReader.Value)
> > End If
> > End While
> > xmlReader.Close()
> > Dim r as Regex
> > dim element as string
> > dim output as string
> > For Each element in alWordList
> > r = New Regex("\b" & element)
> > InputString = r.Replace(InputString, "****")
> > Next
> > TextBox1.Text = InputString
> > If origtext <> TextBox1.Text Then
> > Label1.Text = "Funky words, please replace."
> > Else
> > Label1.Text = "Okay." 'This is just included for testing
> > End If
> > End Sub
> > Private Sub Button1_Click(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles Button1.Click
> > CheckString(TextBox1.Text)
> > End Sub
> > Any suggestions will be greatly appreciated!
> > --
> > Sandy
>

Please click the back button on your browser and

Hi All,

In my one project, at many aspx pages I am getting below error.
Could anyone please give me solution of this.
================
Please click the back button on your browser and try again.Session state is
not available in this context.
================
I really tried to solve this a lot but could not get the solution.

Thanking you in advance,
RahulSeems sessions are disabled for your application and being used everywhere
inside applications...

Sudhakar Sadasivuni
http://weblogs.asp.net/ssadasivuni
MyUG : http://www.mugh.net

"Rahul Borade" wrote:

> Hi All,
> In my one project, at many aspx pages I am getting below error.
> Could anyone please give me solution of this.
> ================
> Please click the back button on your browser and try again.Session state is
> not available in this context.
> ================
> I really tried to solve this a lot but could not get the solution.
> Thanking you in advance,
> Rahul
>
Hi,

Thanks for your immediate reply!

But, if I check session on other aspx pages, the session
state is perfectly available.

What could be any other possiblity for this ... can you
please tell me ...

>--Original Message--
>Seems sessions are disabled for your application and
being used everywhere
>inside applications...
>
>Sudhakar Sadasivuni
>http://weblogs.asp.net/ssadasivuni
>MyUG : http://www.mugh.net
>
>"Rahul Borade" wrote:
>> Hi All,
>>
>> In my one project, at many aspx pages I am getting
below error.
>> Could anyone please give me solution of this.
>> ================
>> Please click the back button on your browser and try
again.Session state is
>> not available in this context.
>> ================
>> I really tried to solve this a lot but could not get
the solution.
>>
>> Thanking you in advance,
>> Rahul
>>
>>
>>
>.