control via checkbox in asp.net using sql server

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


How to retrieve 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>


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.


thanks in advance




Responses

Posted by: Suresh.mekkattil on: 1/12/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Sorry, I didnt get your point clearly!!

-----
Suresh M

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

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

Up
0
Down
my question is
based on after admin login Activate / Inactivate to display the message from database,
If admin (Activate) tick the checkbox display the message in Index page ,
Otherwise
(InActivate) tick the checkbox not display the message.

please give the solution,

thanks.

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

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

Up
0
Down
Hi,

Check this link

http://www.dotnetfunda.com/forums/thread3300-how-to-create-checkbox-permission.aspx

Thanks
Karthik
www.f5Debug.net

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

Login to post response