c# - Linking bootstrap Code with .aspx.cs file -
can tell me how link code written in bootstrap 3.1.1 code in aspx.cs file. want to access different elements(of bootstrap design) in .aspx.cs file using id's.
for example, have html code:
<div class="panel panel-success" style="margin-top:100px;margin-left:50px"> <div class="panel-heading" style="font-size:16px"> to-do list </div> <ol class="list=group" id="list1"> <li class="list-group-item"> complete hci assignment </li> <li class="list-group-item"> complete assignment </li> <li class="list-group-item"> complete programming task </li> <li class="list-group-item"> send code correction </li> </ol> <div class="panel-body"> <button class="btn btn-default btn-success btn-sm" style="margin-left:65px; margin-right:10px" id="b1"> <span class="glyphicon glyphicon-plus"></span> add task </button> <button class="btn btn-default btn-success btn-sm" id="b2"> <span class="glyphicon glyphicon-remove"></span> remove task </button> </div> </div>
i want display data database (sql server) in panel. how do this?
in order access html controls in code behind file, need use asp.net server controls. retrofit existing web page need enclose server controls form tag runat="server" attribute. can add server controls anywhere inside form, such label id "servercontrol" shown below. aware 1 form runat="server" attribute can exist on web page.
<form runat="server"> <div class="panel panel-success" style="margin-top:100px;margin-left:50px"> <div class="panel-heading" style="font-size:16px"> to-do list </div> <ol class="list=group" id="list1"> <% foreach(var task in tasks) { %> <li class="list-group-item"> <%=task.name&> </li> <% } %> </ol> <asp:label runat="server" id="servercontrol" text="results" /> <div class="panel-body"> <button class="btn btn-default btn-success btn-sm" style="margin-left:65px; margin-right:10px" id="b1"> <span class="glyphicon glyphicon-plus"></span> add task </button> <button class="btn btn-default btn-success btn-sm" id="b2"> <span class="glyphicon glyphicon-remove"></span> remove task </button> </div> </div> </form>
http://www.w3schools.com/aspnet/aspnet_controls.asp
you code can perform sql queries , update server controls on web page. i've added c# markup output list collection of 'tasks'. collection populated sql during loading of web form.
Comments
Post a Comment