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>
<aspanel 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>
</aspanel>
<aspanel 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>
</aspanel>
</td>
</tr>
</table>
<table class=FormPopup id=Table1>
<tr>
<td>
<aspanel id=pnlReport1 runat="server" visible="False">
<uc1:generic id=Report1 runat="server"></uc1:generic>
</aspanel>
<aspanel id=pnlReport2 runat="server" visible="False">
<uc2:eps id=Report2 runat="server"></uc2:eps>
</aspanel>
</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
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>
<aspanel 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>
</aspanel>
<aspanel 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>
</aspanel>
</td>
</tr>
</table>
<table class=FormPopup id=Table1>
<tr>
<td>
<aspanel id=pnlReport1 runat="server" visible="False">
<uc1:generic id=Report1 runat="server"></uc1:generic>
</aspanel>
<aspanel id=pnlReport2 runat="server" visible="False">
<uc2:eps id=Report2 runat="server"></uc2:eps>
</aspanel>
</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