The name 'getStudentData' does not exist in the current context
hi,I am trying bind database to hmtl. Because i want use bootstrap datatable jquery.
I am getting following error. I found this coding in online.
'The name 'getStudentData' does not exist in the current context'
<head runat="server">
<meta charset="utf-8" />
<title>Employees Data Fill From Database</title>
<meta name="description" content="Creating a Employee table with Twitter Bootstrap. Learn with example of a Employee Table with Twitter Bootstrap.">
<link href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"
rel="stylesheet" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<link href="http://cdn.datatables.net/1.10.2/css/jquery.dataTables.min.css" rel="stylesheet" />
<script type="text/javascript" src="http://cdn.datatables.net/1.10.2/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<%-- <script type="text/javascript">
$(document).ready(function () {
$('#studentTable').dataTable();
});
</script>--%>
</head>
<body>
<form id="form1" runat="server">
<div>
<table id="studentTable" width="100%" align="center" cellpadding="2" cellspacing="2"
border="0" bgcolor="#EAEAEA">
<tr align="left" style="background-color: #004080; color: White;">
<td>
StudentId
</td>
<td>
Name
</td>
<td>
EmailAddress
</td>
<td>
Gender
</td>
</tr>
<%=getStudentData()%>
</table>
</div>
</form>
</body>
private string getStudentData()
{
string data = "";
int incVal;
int Sl;
int datas;
int heading1;
int heading2;
DataTable dt = new DataTable();
dt.Columns.Add("Sl");
dt.Columns.Add("datas");
dt.Columns.Add("heading1");
dt.Columns.Add("heading2");
for (int i = 0; i < 100; i++)
{
dt.Rows.Add(new object[] { i, 123 * i, 4567 * i, 2 * i, });
}
for (incVal = 0; incVal < dt.Rows.Count; incVal++)
{
Sl = Convert.ToInt32(dt.Rows[incVal]["Sl"].ToString());
datas = Convert.ToInt32(dt.Rows[incVal]["datas"].ToString());
heading1 = Convert.ToInt32(dt.Rows[incVal]["heading1"].ToString());
heading2 = Convert.ToInt32(dt.Rows[incVal]["heading2"].ToString());
data += "<tr><td>" + Sl + "</td><td>" + datas + "</td><td>" + heading1 + "</td><td>" + heading2 + "</td></tr>";
}
return data;
}