ReadOnly (HTML) controls to stay black and not grey

Discussion in 'ASP .Net Web Controls' started by Michael @ SGMS, Nov 28, 2005.

  1. I have a panel that I am using to display several server side controls. I am
    attempting to make some of the (HTML) controls readonly without getting the
    light grey effect that is hard to read and is almost unreadable when you
    print it. I would like the forecolor for my ReadOnly controls to stay black
    and not grey.

    I have several Web User Controls that use the same aspx page.
    Example: Report.aspx

    <form id=Form1 method=post runat="server">
    <div id=divReportContent>
    <table class=FormPopup border=0>
    <tr>
    <td valign=bottom>
    <asp:panel id=pnlhdrReport1 runat="server" width="420px"
    visible="False">
    <asp:imagebutton id=btnReport1 onclick=EditReport runat="server"
    imageurl="imgs/hdrReport1.gif" tooltip="Edit This Report"></asp:imagebutton>
    </asp:panel>
    <asp:panel id=pnlhdrReport2 runat="server" width="420px"
    visible="False">
    <asp:imagebutton id=btnReport2 onclick=EditReport runat="server"
    imageurl="imgs/hdrReport2.gif" tooltip="Edit This Report"></asp:imagebutton>
    </asp:panel>
    </td>
    </tr>
    </table>
    <table class=FormPopup id=Table1>
    <tr>
    <td>
    <asp:panel id=pnlReport1 runat="server" visible="False">
    <uc1:generic id=Report1 runat="server"></uc1:generic>
    </asp:panel>
    <asp:panel id=pnlReport2 runat="server" visible="False">
    <uc2:eps id=Report2 runat="server"></uc2:eps>
    </asp:panel>
    </td>
    </tr>
    </table>
    </div>
    </form>

    These Web User Controls are forms that have radiobuttonlist, checkbox,
    DropDownList and textboxes for the employee to input and edit data. We also
    have our customers log in to view these Reports, but it ReadOnly for the
    Customers, so they can not change the form. They just need to view and/or
    print. Here is the code from the class file.

    ReportControl.vb

    Protected Function IsInputFormMode() As Boolean
    Dim path As String = UCase(Request.Url.GetLeftPart(UriPartial.Path))
    If path.IndexOf("Report.ASPX") <> -1 Then
    Return True
    Else
    Return False
    End If
    End Function

    Protected Sub SetReadOnlyState(ByRef pnl As System.Web.UI.WebControls.Panel,
    ByVal ros As Boolean)

    Dim cEnum As IEnumerator = pnl.Controls.GetEnumerator
    Dim rblObj As RadioButtonList = New RadioButtonList
    Dim cbObj As CheckBox = New CheckBox
    Dim ddlObj As DropDownList = New DropDownList
    Dim txtObj As System.Web.UI.WebControls.TextBox = New
    System.Web.UI.WebControls.TextBox
    While (cEnum.MoveNext())
    Dim strType As String = cEnum.Current.GetType().ToString()
    If strType Like rblObj.GetType().ToString() Then
    cEnum.Current.Enabled = ros
    ElseIf strType Like ddlObj.GetType().ToString() Then
    cEnum.Current.Enabled = ros
    ElseIf strType Like txtObj.GetType().ToString() Then
    cEnum.Current.Enabled = ros
    ElseIf strType Like cbObj.GetType().ToString() Then
    cEnum.Current.Enabled = ros
    End If
    End While
    End Sub


    Report1.ascx.vb

    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    If WebSecurity.IsInRoles("Customer") = True Then
    SetReadOnlyState(pnlGenericInputs, IsInputFormMode())
    End If
    End Sub
     
    Michael @ SGMS, Nov 28, 2005
    #1
    1. Advertising

  2. Michael,
    You can change the backcolor of the control to white color.This will
    make you achieve what u expect.


    "Michael @ SGMS" wrote:

    > I have a panel that I am using to display several server side controls. I am
    > attempting to make some of the (HTML) controls readonly without getting the
    > light grey effect that is hard to read and is almost unreadable when you
    > print it. I would like the forecolor for my ReadOnly controls to stay black
    > and not grey.
    >
    > I have several Web User Controls that use the same aspx page.
    > Example: Report.aspx
    >
    > <form id=Form1 method=post runat="server">
    > <div id=divReportContent>
    > <table class=FormPopup border=0>
    > <tr>
    > <td valign=bottom>
    > <asp:panel id=pnlhdrReport1 runat="server" width="420px"
    > visible="False">
    > <asp:imagebutton id=btnReport1 onclick=EditReport runat="server"
    > imageurl="imgs/hdrReport1.gif" tooltip="Edit This Report"></asp:imagebutton>
    > </asp:panel>
    > <asp:panel id=pnlhdrReport2 runat="server" width="420px"
    > visible="False">
    > <asp:imagebutton id=btnReport2 onclick=EditReport runat="server"
    > imageurl="imgs/hdrReport2.gif" tooltip="Edit This Report"></asp:imagebutton>
    > </asp:panel>
    > </td>
    > </tr>
    > </table>
    > <table class=FormPopup id=Table1>
    > <tr>
    > <td>
    > <asp:panel id=pnlReport1 runat="server" visible="False">
    > <uc1:generic id=Report1 runat="server"></uc1:generic>
    > </asp:panel>
    > <asp:panel id=pnlReport2 runat="server" visible="False">
    > <uc2:eps id=Report2 runat="server"></uc2:eps>
    > </asp:panel>
    > </td>
    > </tr>
    > </table>
    > </div>
    > </form>
    >
    > These Web User Controls are forms that have radiobuttonlist, checkbox,
    > DropDownList and textboxes for the employee to input and edit data. We also
    > have our customers log in to view these Reports, but it ReadOnly for the
    > Customers, so they can not change the form. They just need to view and/or
    > print. Here is the code from the class file.
    >
    > ReportControl.vb
    >
    > Protected Function IsInputFormMode() As Boolean
    > Dim path As String = UCase(Request.Url.GetLeftPart(UriPartial.Path))
    > If path.IndexOf("Report.ASPX") <> -1 Then
    > Return True
    > Else
    > Return False
    > End If
    > End Function
    >
    > Protected Sub SetReadOnlyState(ByRef pnl As System.Web.UI.WebControls.Panel,
    > ByVal ros As Boolean)
    >
    > Dim cEnum As IEnumerator = pnl.Controls.GetEnumerator
    > Dim rblObj As RadioButtonList = New RadioButtonList
    > Dim cbObj As CheckBox = New CheckBox
    > Dim ddlObj As DropDownList = New DropDownList
    > Dim txtObj As System.Web.UI.WebControls.TextBox = New
    > System.Web.UI.WebControls.TextBox
    > While (cEnum.MoveNext())
    > Dim strType As String = cEnum.Current.GetType().ToString()
    > If strType Like rblObj.GetType().ToString() Then
    > cEnum.Current.Enabled = ros
    > ElseIf strType Like ddlObj.GetType().ToString() Then
    > cEnum.Current.Enabled = ros
    > ElseIf strType Like txtObj.GetType().ToString() Then
    > cEnum.Current.Enabled = ros
    > ElseIf strType Like cbObj.GetType().ToString() Then
    > cEnum.Current.Enabled = ros
    > End If
    > End While
    > End Sub
    >
    >
    > Report1.ascx.vb
    >
    > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > System.EventArgs) Handles MyBase.Load
    >
    > If WebSecurity.IsInRoles("Customer") = True Then
    > SetReadOnlyState(pnlGenericInputs, IsInputFormMode())
    > End If
    > End Sub
    >
     
    Santhi Maadhaven, Nov 30, 2005
    #2
    1. Advertising

  3. Thank you for your reply Santhi, but the back ground is already white and
    this does not change the look of the gray color of the radio button control.
    When the customer prints the Report.aspx file, the rdo's are hard to see
    when disabled.

    "Santhi Maadhaven" wrote:

    > Michael,
    > You can change the backcolor of the control to white color.This will
    > make you achieve what u expect.
    >
    >
    > "Michael @ SGMS" wrote:
    >
    > > I have a panel that I am using to display several server side controls. I am
    > > attempting to make some of the (HTML) controls readonly without getting the
    > > light grey effect that is hard to read and is almost unreadable when you
    > > print it. I would like the forecolor for my ReadOnly controls to stay black
    > > and not grey.
    > >
    > > I have several Web User Controls that use the same aspx page.
    > > Example: Report.aspx
    > >
    > > <form id=Form1 method=post runat="server">
    > > <div id=divReportContent>
    > > <table class=FormPopup border=0>
    > > <tr>
    > > <td valign=bottom>
    > > <asp:panel id=pnlhdrReport1 runat="server" width="420px"
    > > visible="False">
    > > <asp:imagebutton id=btnReport1 onclick=EditReport runat="server"
    > > imageurl="imgs/hdrReport1.gif" tooltip="Edit This Report"></asp:imagebutton>
    > > </asp:panel>
    > > <asp:panel id=pnlhdrReport2 runat="server" width="420px"
    > > visible="False">
    > > <asp:imagebutton id=btnReport2 onclick=EditReport runat="server"
    > > imageurl="imgs/hdrReport2.gif" tooltip="Edit This Report"></asp:imagebutton>
    > > </asp:panel>
    > > </td>
    > > </tr>
    > > </table>
    > > <table class=FormPopup id=Table1>
    > > <tr>
    > > <td>
    > > <asp:panel id=pnlReport1 runat="server" visible="False">
    > > <uc1:generic id=Report1 runat="server"></uc1:generic>
    > > </asp:panel>
    > > <asp:panel id=pnlReport2 runat="server" visible="False">
    > > <uc2:eps id=Report2 runat="server"></uc2:eps>
    > > </asp:panel>
    > > </td>
    > > </tr>
    > > </table>
    > > </div>
    > > </form>
    > >
    > > These Web User Controls are forms that have radiobuttonlist, checkbox,
    > > DropDownList and textboxes for the employee to input and edit data. We also
    > > have our customers log in to view these Reports, but it ReadOnly for the
    > > Customers, so they can not change the form. They just need to view and/or
    > > print. Here is the code from the class file.
    > >
    > > ReportControl.vb
    > >
    > > Protected Function IsInputFormMode() As Boolean
    > > Dim path As String = UCase(Request.Url.GetLeftPart(UriPartial.Path))
    > > If path.IndexOf("Report.ASPX") <> -1 Then
    > > Return True
    > > Else
    > > Return False
    > > End If
    > > End Function
    > >
    > > Protected Sub SetReadOnlyState(ByRef pnl As System.Web.UI.WebControls.Panel,
    > > ByVal ros As Boolean)
    > >
    > > Dim cEnum As IEnumerator = pnl.Controls.GetEnumerator
    > > Dim rblObj As RadioButtonList = New RadioButtonList
    > > Dim cbObj As CheckBox = New CheckBox
    > > Dim ddlObj As DropDownList = New DropDownList
    > > Dim txtObj As System.Web.UI.WebControls.TextBox = New
    > > System.Web.UI.WebControls.TextBox
    > > While (cEnum.MoveNext())
    > > Dim strType As String = cEnum.Current.GetType().ToString()
    > > If strType Like rblObj.GetType().ToString() Then
    > > cEnum.Current.Enabled = ros
    > > ElseIf strType Like ddlObj.GetType().ToString() Then
    > > cEnum.Current.Enabled = ros
    > > ElseIf strType Like txtObj.GetType().ToString() Then
    > > cEnum.Current.Enabled = ros
    > > ElseIf strType Like cbObj.GetType().ToString() Then
    > > cEnum.Current.Enabled = ros
    > > End If
    > > End While
    > > End Sub
    > >
    > >
    > > Report1.ascx.vb
    > >
    > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > System.EventArgs) Handles MyBase.Load
    > >
    > > If WebSecurity.IsInRoles("Customer") = True Then
    > > SetReadOnlyState(pnlGenericInputs, IsInputFormMode())
    > > End If
    > > End Sub
    > >
     
    Michael @ SGMS, Nov 30, 2005
    #3
  4. Michael ,
    You cant change the grey color of the radio button.You change the
    flatstyle property as Flat or PopUp instead of standard .This will look
    better when u print ur page.

    "Michael @ SGMS" wrote:

    > Thank you for your reply Santhi, but the back ground is already white and
    > this does not change the look of the gray color of the radio button control.
    > When the customer prints the Report.aspx file, the rdo's are hard to see
    > when disabled.
    >
    > "Santhi Maadhaven" wrote:
    >
    > > Michael,
    > > You can change the backcolor of the control to white color.This will
    > > make you achieve what u expect.
    > >
    > >
    > > "Michael @ SGMS" wrote:
    > >
    > > > I have a panel that I am using to display several server side controls. I am
    > > > attempting to make some of the (HTML) controls readonly without getting the
    > > > light grey effect that is hard to read and is almost unreadable when you
    > > > print it. I would like the forecolor for my ReadOnly controls to stay black
    > > > and not grey.
    > > >
    > > > I have several Web User Controls that use the same aspx page.
    > > > Example: Report.aspx
    > > >
    > > > <form id=Form1 method=post runat="server">
    > > > <div id=divReportContent>
    > > > <table class=FormPopup border=0>
    > > > <tr>
    > > > <td valign=bottom>
    > > > <asp:panel id=pnlhdrReport1 runat="server" width="420px"
    > > > visible="False">
    > > > <asp:imagebutton id=btnReport1 onclick=EditReport runat="server"
    > > > imageurl="imgs/hdrReport1.gif" tooltip="Edit This Report"></asp:imagebutton>
    > > > </asp:panel>
    > > > <asp:panel id=pnlhdrReport2 runat="server" width="420px"
    > > > visible="False">
    > > > <asp:imagebutton id=btnReport2 onclick=EditReport runat="server"
    > > > imageurl="imgs/hdrReport2.gif" tooltip="Edit This Report"></asp:imagebutton>
    > > > </asp:panel>
    > > > </td>
    > > > </tr>
    > > > </table>
    > > > <table class=FormPopup id=Table1>
    > > > <tr>
    > > > <td>
    > > > <asp:panel id=pnlReport1 runat="server" visible="False">
    > > > <uc1:generic id=Report1 runat="server"></uc1:generic>
    > > > </asp:panel>
    > > > <asp:panel id=pnlReport2 runat="server" visible="False">
    > > > <uc2:eps id=Report2 runat="server"></uc2:eps>
    > > > </asp:panel>
    > > > </td>
    > > > </tr>
    > > > </table>
    > > > </div>
    > > > </form>
    > > >
    > > > These Web User Controls are forms that have radiobuttonlist, checkbox,
    > > > DropDownList and textboxes for the employee to input and edit data. We also
    > > > have our customers log in to view these Reports, but it ReadOnly for the
    > > > Customers, so they can not change the form. They just need to view and/or
    > > > print. Here is the code from the class file.
    > > >
    > > > ReportControl.vb
    > > >
    > > > Protected Function IsInputFormMode() As Boolean
    > > > Dim path As String = UCase(Request.Url.GetLeftPart(UriPartial.Path))
    > > > If path.IndexOf("Report.ASPX") <> -1 Then
    > > > Return True
    > > > Else
    > > > Return False
    > > > End If
    > > > End Function
    > > >
    > > > Protected Sub SetReadOnlyState(ByRef pnl As System.Web.UI.WebControls.Panel,
    > > > ByVal ros As Boolean)
    > > >
    > > > Dim cEnum As IEnumerator = pnl.Controls.GetEnumerator
    > > > Dim rblObj As RadioButtonList = New RadioButtonList
    > > > Dim cbObj As CheckBox = New CheckBox
    > > > Dim ddlObj As DropDownList = New DropDownList
    > > > Dim txtObj As System.Web.UI.WebControls.TextBox = New
    > > > System.Web.UI.WebControls.TextBox
    > > > While (cEnum.MoveNext())
    > > > Dim strType As String = cEnum.Current.GetType().ToString()
    > > > If strType Like rblObj.GetType().ToString() Then
    > > > cEnum.Current.Enabled = ros
    > > > ElseIf strType Like ddlObj.GetType().ToString() Then
    > > > cEnum.Current.Enabled = ros
    > > > ElseIf strType Like txtObj.GetType().ToString() Then
    > > > cEnum.Current.Enabled = ros
    > > > ElseIf strType Like cbObj.GetType().ToString() Then
    > > > cEnum.Current.Enabled = ros
    > > > End If
    > > > End While
    > > > End Sub
    > > >
    > > >
    > > > Report1.ascx.vb
    > > >
    > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    > > > System.EventArgs) Handles MyBase.Load
    > > >
    > > > If WebSecurity.IsInRoles("Customer") = True Then
    > > > SetReadOnlyState(pnlGenericInputs, IsInputFormMode())
    > > > End If
    > > > End Sub
    > > >
     
    Santhi Maadhaven, Dec 1, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AAA
    Replies:
    0
    Views:
    524
  2. Tiësto
    Replies:
    3
    Views:
    4,363
    Tiësto
    Nov 22, 2004
  3. Anony!

    How to "grey out" a JButton?

    Anony!, Aug 15, 2004, in forum: Java
    Replies:
    3
    Views:
    826
    zoopy
    Aug 16, 2004
  4. Jonathan Hyatt
    Replies:
    1
    Views:
    1,949
    Jonathan Hyatt
    Jun 8, 2004
  5. Replies:
    3
    Views:
    201
Loading...

Share This Page