bind data from sqlserver to labels
I want to bind data that have 5 Columns, into each labels that I had
prepared. for example,
(row1,col1) bind to label1 (row1,col2) bind to label2
but the row in my database has not exact row, it can be 5 row, 6 row, etc.
but the column is exactly five column. Can help me with the code behind? I
need to bind it when the user press a button.
Hope someone can help me.. thx in advance! :)
here is my aspx code
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master"
AutoEventWireup="false" CodeFile="input_khs.aspx.vb" Inherits="input_khs"
%>
h1 { color: orange; font-size: 20px; border-bottom: solid 1px teal;
margin-top: 10px; }
input
{
border: 1px solid #c4c4c4;
width: 180px;
height: 18px;
font-size: 13px;
padding: 4px 4px 4px 4px;
border-radius: 4px;
-moz-border-radius: 4px;
-webkit-border-radius: 4px;
box-shadow: 0px 0px 8px #d9d9d9;
-moz-box-shadow: 0px 0px 8px #d9d9d9;
-webkit-box-shadow: 0px 0px 8px #d9d9d9;
}
input:focus
{
outline: none;
border: 1px solid #7bc1f7;
box-shadow: 0px 0px 8px #7bc1f7;
-moz-box-shadow: 0px 0px 8px #7bc1f7;
-webkit-box-shadow: 0px 0px 8px #7bc1f7;
}
.button
{
display: inline-block;
outline: none;
cursor: pointer;
text-align: center;
text-decoration: none;
font: 14px/100% Arial, Helvetica, sans-serif;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: .5em;
-moz-border-radius: .5em;
border-radius: .5em;
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.2);
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.2);
box-shadow: 0 1px 2px rgba(0,0,0,.2);
color: #d9eef7;
border: solid 1px #0076a3;
background: #0095cd;
background: -webkit-gradient(linear, left top, left bottom,
from(#00adee), to(#0078a5));
background: -moz-linear-gradient(top, #00adee, #0078a5);
filter:
progid:DXImageTransform.Microsoft.gradient(startColorstr='#00adee',
endColorstr='#0078a5');
}
.button:hover
{
text-decoration: none;
background: #f47c20;
background: -webkit-gradient(linear, left top, left bottom,
from(#f88e11), to(#f06015));
background: -moz-linear-gradient(top, #f88e11, #f06015);
filter:
progid:DXImageTransform.Microsoft.gradient(startColorstr='#f88e11',
endColorstr='#f06015');
}
.button:active
{
position: relative;
top: 1px;
color: #fcd3a5;
background: -webkit-gradient(linear, left top, left bottom,
from(#f47a20), to(#faa51a));
background: -moz-linear-gradient(top, #f47a20, #faa51a);
filter:
progid:DXImageTransform.Microsoft.gradient(startColorstr='#f47a20',
endColorstr='#faa51a');
}
.mGrid
{
width: 100%;
background-color: #fff;
margin: 5px 0 10px 0;
border: solid 1px #525252;
border-collapse:collapse;
}
.mGrid td
{
padding: 2px;
border: solid 1px #c1c1c1;
color: #717171;
}
.mGrid th
{
padding: 4px 2px;
color: #fff;
background: #424242 url(~stylesheet\grd_head.png) repeat-x top;
border-left: solid 1px #525252;
font-size: 0.9em;
}
.mGrid .alt { background: #fcfcfc url(~stylesheet\grd_alt.png) repeat-x
top; }
.mGrid .pgr { background: #424242 url(~stylesheet\grd_pgr.png) repeat-x
top; }
.mGrid .pgr table { margin: 5px 0; }
.mGrid .pgr td
{
border-width: 0;
padding: 0 6px;
border-left: solid 1px #666;
font-weight: bold;
color: #fff;
line-height: 12px;
}
.mGrid .pgr a { color: #666; text-decoration: none; }
.mGrid .pgr a:hover { color: #000; text-decoration: none; }
.mGrid a
{
color: #fff;
text-decoration:underline;
}
.mGrid tr:hover
{
background-color: aqua;
color:white;
}
:
<p>
<asp:Label ID="lbl_nama" Text="Nama" runat="server" Height="20px"
Width="100px"></asp:Label>:
<asp:TextBox ID="txt_nama" runat="server" Height="20px"
Width="220px"></asp:TextBox>
<asp:ImageButton ID="find_btn1" runat="server"
ImageUrl="~/Images/search-icon.png" Height="20px" Width="20px"
ImageAlign="AbsMiddle" />
</p>
<p>
<asp:Label ID="lbl_nim" Text="NIM" runat="server" Height="20px"
Width="100px"></asp:Label>:
<asp:TextBox ID="txt_nim" runat="server" Height="20px"
Width="220px"></asp:TextBox>
<asp:ImageButton ID="find_btn2" runat="server"
ImageUrl="~/Images/search-icon.png" Height="20px" Width="20px"
ImageAlign="AbsMiddle" />
</p>
</div>
<div style="margin-top:10px; border:solid 2px #7bc1f7; border-radius:20px;
padding:10px;">
<asp:Label ID="Label1" runat="server" Text="NO" Height="20px"
Width="25px"></asp:Label>  
<asp:Label ID="Label14" runat="server" Text="KODE" Height="20px"
Width="85px"></asp:Label>
<asp:Label ID="Label16" runat="server" Text="MATA KULIAH"
Height="20px" Width="300px"></asp:Label>
<asp:Label ID="Label17" runat="server" Text="SKS" Height="20px"
Width="40px"></asp:Label>
<asp:Label ID="Label18" runat="server" Text="NILAI" Height="20px"
Width="300px"></asp:Label>
<asp:Label ID="Label19" runat="server" Text="SKN" Height="20px"
Width="35px"></asp:Label><br />
<asp:Label ID="Label2" runat="server" Text="1" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk1" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk1" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks1" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai1" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn1" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox1" runat="server" Width="5px" /><br />
<asp:Label ID="Label3" runat="server" Text="2" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk2" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk2" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks2" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai2" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn2" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox2" runat="server" Width="5px" /><br />
<asp:Label ID="Label4" runat="server" Text="3" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk3" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk3" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks3" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai3" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn3" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox3" runat="server" Width="5px" /><br />
<asp:Label ID="Label5" runat="server" Text="4" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk4" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk4" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks4" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai4" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn4" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox4" runat="server" Width="5px" /><br />
<asp:Label ID="Label6" runat="server" Text="5" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk5" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk5" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks5" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai5" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn5" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox5" runat="server" Width="5px" /><br />
<asp:Label ID="Label7" runat="server" Text="6" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk6" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk6" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks6" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai6" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn6" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox6" runat="server" Width="5px" /><br />
<asp:Label ID="Label8" runat="server" Text="7" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk7" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk7" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks7" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai7" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn7" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox7" runat="server" Width="5px" /><br />
<asp:Label ID="Label9" runat="server" Text="8" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk8" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk8" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks8" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai8" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn8" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox8" runat="server" Width="5px" /><br />
<asp:Label ID="Label10" runat="server" Text="9" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk9" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk9" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks9" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai9" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn9" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox9" runat="server" Width="5px" /><br />
<asp:Label ID="Label11" runat="server" Text="10" Height="20px"
Width="25px"></asp:Label>
<asp:Label ID="lbl_kode_mk10" Text="-" runat="server"
Width="85px"></asp:Label>
<asp:Label ID="lbl_mk10" Text="*****" runat="server"
Width="300px"></asp:Label>
<asp:Label ID="lbl_sks10" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_nilai10" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:Label ID="lbl_skn10" Text="-" runat="server"
Width="20px"></asp:Label>
<asp:CheckBox ID="CheckBox10" runat="server" Width="5px" /><br />
</div>
No comments:
Post a Comment