|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ReadOnly (HTML) controls to stay black and not greyattempting 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,
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 > 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 > > 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 > > >
Other interesting topics
VS2005 C# is very BUGGY, please hlp
custom control client values gone with postback Server Control - object not saved when button clicked How to cycle through checkboxes in a datagrid and find out which ones are checked? repost: custom control client values gone with postback -- no solution found... DropDownList Value Setting focus to TextBox Maintaining "id" attribute value in server controls What is the Equivalent of the CurrentRowIndex Property for a DataGrid Web Control? Help on rendering a control from page ??? |
|||||||||||||||||||||||