vendredi 28 juillet 2017

how to load the checkbox values and persist them on postback in asp.net webforms

I have a bunch of checkboxes and a textbox which I have hardcoded at this point. According to the business rule, The checkbox selection needs to get saved and also, on post back or page refresh the selection needs to persist, in my case I am able to save the values to the database, but, unable to load them again on postback. Can someone provide me a example to handle this. I think that I need to write a load method to do this. Can someone provide me with an example.

Code:

                                                                <asp:CheckBox runat="server" ID="chkRS" Text="RS" />
                                                                </div>
                                                                <br />

                                                                <asp:CheckBox runat="server" ID="chkSC" Text="SSC" />

                                                                <br />

                                                                <asp:CheckBox runat="server" ID="SCR" Text="SCR" />

                                                                <br />

                                                                <asp:Label runat="server" AssociatedControlID="txtPrint">Print Button Class</asp:Label>
                                                                <asp:TextBox runat="server" ID="txtPrint" CssClass="form-control"></asp:TextBox>

                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                    </div>




Aucun commentaire:

Enregistrer un commentaire