Home All Groups Group Topic Archive Search About

ReadOnly (HTML) controls to stay black and not grey

Author
28 Nov 2005 4:35 PM
Michael @ SGMS
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

Author
30 Nov 2005 8:41 AM
Santhi Maadhaven
Michael,
      You can change the backcolor of the control to white color.This will
make you achieve what u expect.


Show quoteHide quote
"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
>
Are all your drivers up to date? click for free checkup

Author
30 Nov 2005 3:12 PM
Michael @ SGMS
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.

Show quoteHide quote
"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
> >
Author
1 Dec 2005 6:30 AM
Santhi Maadhaven
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.

Show quoteHide quote
"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
> > >

Bookmark and Share