Not sure if I added the code right but I still have the same problem
when I go back and select the blank line in the jobno dropdown list
the GLAcct textbox still stays disabled.
Here is my code.
Protected Sub DD_jobno_TextChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DD_jobno.TextChanged
If DD_jobno.DataValueField.Trim.Length = 1 Then
GLAcct.Enabled = True
Else
GLAcct.BackColor = Drawing.Color.Gray
GLAcct.Enabled = False
End If
End Sub
On Oct 22, 6:21 am, Glenn <[EMAIL PROTECTED]> wrote:
> There is a difference between " " and "". In your check, you should check
> for the length of the trimmed value rather than checking for " ".
> (DD_jobno.DataValueField.Trim().Length() in C# syntax) Your check will only
> be true if the field contains a single space. If there is more than one or
> less than one, your test will fail.
>
> ...Glenn
>
>
>
> On Tue, Oct 21, 2008 at 5:56 PM, Imstac <[EMAIL PROTECTED]> wrote:
>
> > So I added the following event handler in my Web app, dropdown list to
> > add a blank item.
>
> > Protected Sub DD_jobno_DataBound(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles DD_jobno.DataBound, DD_jobno.DataBound
> > DirectCast(sender, DropDownList).Items.Insert(0, String.Empty)
> > End Sub
>
> > I'm not sure that this is the best method to use b/c I now have two
> > blank lines in my dropdown list.
>
> > Also, I have another event handler (on textchanged) for this same
> > dropdown list that if the value of the dropdown list is blank then to
> > enable my textbox (GLAcct) and if the value is not empty to disable my
> > textbox and gray it out. This works fine if I select a value in my
> > dropdown list; however if I go back and select the blank item in my
> > dropdown list it does not re-enable my textbox. I'm not sure what I'm
> > doing wrong. Here is my code:
>
> > Protected Sub DD_jobno_TextChanged(ByVal sender As Object, ByVal e As
> > System.EventArgs) Handles DD_jobno.TextChanged
> > If DD_jobno.DataValueField = " " Then
> > GLAcct.Enabled = True
>
> > Else
> > GLAcct.BackColor = Drawing.Color.Gray
> > GLAcct.Enabled = False
>
> > End If
>
> > End Sub- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/DotNetDevelopment
You may subscribe to group Feeds using a RSS Feed Reader to stay upto date
using following url
<a href="http://feeds.feedburner.com/DotNetDevelopment">
http://feeds.feedburner.com/DotNetDevelopment</a>
-~----------~----~----~----~------~----~------~--~---