how to create checkbox permission

Posted by Dn2010 under ASP.NET on 1/11/2011 | Points: 10 | Views : 1939 | Status : [Member] | Replies : 10
hi friends,

if Admin ,select the checkbox ,display the value from database in home page.
then again deselect the checkbox, does not display the data in homepage.


how to create it,

please give in detail.




Responses

Posted by: Karthikanbarasan on: 1/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi,

It depends on the control you use to show the data in home page. if u are using grid view you can make the visibility false when unchecked the check box so it will nto display.

Thanks
Karthik
www.f5Debug.net

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dn2010 on: 1/11/2011 [Member] Starter | Points: 25

Up
0
Down
thanks for response,

My question is,

Admin after login page goes to adminhome ,

then,

admin check the checkbox to show the message from database in IndexPage .
admin uncheck the checkbox doeanto show the data in IndexPage.

how to create it please give in detail.

thanks.

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Hi Dn2010,

Your questions is not understandable... especially this section

if admin sign in,,then goes to adminpage ,
then,
admin, select the checkbox for show the details in homepage .
SHOW the details in homepage,otherwise does not show details.


Admin after login , then it will be redirected to which page? and check box will be available in which page?

Thanks
Karthik
www.f5Debug.net

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dn2010 on: 1/11/2011 [Member] Starter | Points: 25

Up
0
Down
Admin after login page goes adminhome ,

then,

admin check the checkbox in gridview to show the message from database in IndexPage .
otherwise,admin uncheck the checkbox in gridview does not show the message in IndexPage.

how to create it please give in detail.

thanks.

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 1/11/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
This is simple. But next time please explain more clearly so that you will help quickly.

What you need is to a Database Field that you will Update every time the Administrator tick a check box. e.g

You can have a Field of a bit Data-type

if the Administrator check it the check box , you will add 1 else 0. and if there is a feature in your app that you want to switch on or off you can use this. in your app you need to check if this is on or off before you show the feature.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Karthikanbarasan on: 1/11/2011 [Member] [Moderator] [Microsoft_MVP] [MVP] Silver | Points: 25

Up
0
Down
Thanks Vuyiswa Maseko for posting....

Dn2010 u can use the approach which Vuyiswa Maseko has posted...

Let me know if u need any help.

Thanks
Karthik
www.f5Debug.net

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dn2010 on: 1/11/2011 [Member] Starter | Points: 25

Up
0
Down
thanks for yours response,

please give the code for it.

thanks.

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 1/12/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
It will be Difficult to give you the exact code that you want , but these are the steps that you would normally follow

Step1:

From your existing table add a bit datatype field that will turn on or off a feature

Step 2:

In your Administration Module , add a checkbox and add a code that will Update the Field that you just added, you StoredProcedure will look like this

Create proc uspUpdatefeuture

(
@Option bit
)
as

Update MyTable
set MyNewBitField = @Option


and you will be calling this Storeprocedure to update the feature.

Step3:

For interest sake, let's say you wanted to hide a menu and show it based on the feature turn on or off. what you would do, is to check against that Field in the where of your Query and say

Where MyNewBitField =1


and this will show the feature only when it is turned on only.

Thank you for posting at Dotnetfunda

Vuyiswa Maseko


Thank you for posting at Dotnetfunda
[Administrator]

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Dn2010 on: 1/12/2011 [Member] Starter | Points: 25

Up
0
Down
thanks for your efforts,

How to retrive in behind the code,

this is checkboxed gridview ,

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false" CellPadding="4"
Font-Bold="True" ForeColor="#333333" GridLines="None"
Style="position: relative">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkSelectAll" runat="server" />
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="chkBxmsg" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="uname" HeaderText="Name" />
<asp:BoundField DataField="pw" HeaderText="Pass" />
</Columns>
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>



please give the solution for this.
thanks.

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Vuyiswamb on: 1/12/2011 [Member] [MVP] [Administrator] NotApplicable | Points: 25

Up
0
Down
Ok what you need to do here is to add a Button that will Update the Records that have been selected. Do you know how to find the Ticked Record ID's ?



Thank you for posting at Dotnetfunda
[Administrator]

Dn2010, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response