ReadOnly (HTML) controls to stay black and not grey

M

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
 
S

Santhi Maadhaven

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

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.
 
S

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.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top