Results 1 to 4 of 4

Thread: lable Question

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2005
    Location
    dallas,texasd
    Posts
    26

    lable Question

    I would like to add this code so the the label would not appeer if the rows.count was greater than = 0

    HOW would i write this TO NOT be visible?? ---> lblWidth.Visible = False


    ===================Code that i want to add it to==============

    cmdMetroSelectFauxWoodColor.Parameters("@IDProduct").Value = Request("IDProduct")
    Dim dsMetroSelectFauxColor As New DataSet
    Dim daMetroSelectFauxColor As New SqlDataAdapter
    daMetroSelectFauxColor.SelectCommand = cmdMetroSelectFauxWoodColor
    daMetroSelectFauxColor.Fill(dsMetroSelectFauxColor, "MetroSelectFauxColor")

    If dsMetroSelectFauxColor.Tables("MetroSelectFauxColor").Rows.Count = 0 Then
    ddlMetroSelectFauxColor.Visible = False
    lblWidth.Visible = False
    Else
    ------------------------HERE++++ HERE----------------lblWidth.Visible = False

    ddlMetroSelectFauxColor.DataSource = dsMetroSelectFauxColor
    ddlMetroSelectFauxColor.DataMember = "MetroSelectFauxColor"
    ddlMetroSelectFauxColor.DataTextField = "AttributeName"
    ddlMetroSelectFauxColor.DataValueField = "AttributeName"
    lblWidth.Visible = False
    End If


    Thanks!

    Erik...

  2. #2
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: lable Question

    VB Code:
    1. If dsMetroSelectFauxColor.Tables("MetroSelectFauxColor").Rows.Count = 0 Then
    2. ddlMetroSelectFauxColor.Visible = False
    3. lblWidth.Visible = False
    4. ElseIf dsMetroSelectFauxColor.Tables("MetroSelectFauxColor").Rows.Count > 0 Then
    5. lblWidth.Visible = True
    6.  
    7. ddlMetroSelectFauxColor.DataSource = dsMetroSelectFauxColor
    8. ddlMetroSelectFauxColor.DataMember = "MetroSelectFauxColor"
    9. ddlMetroSelectFauxColor.DataTextField = "AttributeName"
    10. ddlMetroSelectFauxColor.DataValueField = "AttributeName"
    11. lblWidth.Visible = False
    12. End If

  3. #3
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: lable Question

    If your label will only apear under certian condition you can set it's visible to false in the page load and only set it's vissible to true when you condition is checked and met. The only draw back here is that you will need to evaluate the condition on every poast back for it work properly. I do this for error messages and for any user info that will not be valid after a post back.....
    Magiaus

    If I helped give me some points.

  4. #4
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Re: lable Question

    Another option though more complex would be to have a place holder control and add you label to the control when it is needed but it's more work that it is worth in my opinion.
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width