Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data View Question

Status
Not open for further replies.

dembyg

Programmer
Oct 20, 2001
58
0
0
US
Hello All,
I have a question. I am working on a form which should display only fields and controls that are pertainent to the logged user. for example i have male, female, and child checkboxes and when an individual logs into the system i would like to only show say a woman just the female checkbox and make the other checkboxes invisible... How can this be accomplished. I've tried the findcontrol feature...
Dim cb = CType(gdAgents.FindControl("bFemale"), CheckBox)
I need help... thanks
 
gdAgents is the name of my grid: heres a sample to the code
<asp:GridView ID="gdAgents" runat="server" BackColor="White" BorderColor="#E7E7FF"
BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Horizontal" AutoGenerateColumns="False" DataSourceID="sqlAgentData">
<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />
<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />
<AlternatingRowStyle BackColor="#F7F7F7" />
<Columns>
<asp:BoundField DataField="sagentfirstname" HeaderText="First Name" SortExpression="sagentfirstname" />
<asp:BoundField DataField="sagentlastname" HeaderText="Last Name" SortExpression="sagentlastname">
<ItemStyle HorizontalAlign="Left" />
</asp:BoundField>
<asp:CheckBoxField DataField="bFemale" HeaderText="Female" SortExpression="bFemale">
<ItemStyle HorizontalAlign="Center" />
</asp:CheckBoxField>
<asp:CheckBoxField DataField="bMale" HeaderText="Male" SortExpression="bMale">
<ItemStyle HorizontalAlign="Center" />
</asp:CheckBoxField>
 
I've got to be honest and say a single checkbox for this display purpose seems innapropriate if the text is either Male OR Female, as a checkbox indicates a single true/false. Essentially you're displaying;
Male: True/False
OR
Female: True/False

A Radio Button List with two options, Male and Female and with one selected appropriately, would IMHO be a far better choice and better represent your data.

Rhys
The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offense Edsgar Dijkstra

Church of the Flying Spaghetti Monster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top