Please i have a stored procedure which i want to run upon clicking on a colum stream and automatically insert new values from the table how can i implement this using asp.net
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
border-style: solid;
border-width: 2px;
}
</style>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.20/js/jquery.dataTables.min.js"></script>
<link href="https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
$(function () {
$("[id*=StudentGrid]").DataTable(
{
bLengthChange: true,
lengthMenu: [[15, 20, -1], [15, 20, "All"]],
bFilter: true,
bSort: true,
bPaginate: true
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td> </td>
<td> </td>
<td> </td>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit Record" Width="99px" />
</td>
<td rowspan="2"> </td>
</tr>
<tr>
<td colspan="4">
<asp:GridView ID="StudentGrid" runat="server" AutoGenerateColumns="False" ItemStyle-Width="Auto" CellSpacing="1" ClientIDMode="Static">
<Columns>
<asp:BoundField DataField="admno" HeaderText="Admno" SortExpression="account" />
<asp:BoundField DataField="Name" HeaderText="Student Name" SortExpression="Name" />
<asp:TemplateField HeaderText="Class">
<ItemTemplate>
<asp:DropDownList ID="ddlCLASS" runat="server" Height="22px" Width="74px">
</asp:DropDownList>
<asp:Label ID="lblCategory2" runat="server" Text='<%# Eval("Class") %>' Visible="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Stream">
<ItemTemplate>
<asp:DropDownList ID="ddlStream" runat="server" Height="21px" Width="98px" OnSelectedIndexChanged="ddlStream_SelectedIndexChanged">
</asp:DropDownList>
<asp:Label ID="lblCategory3" runat="server" Text='<%# Eval("Stream") %>' Visible="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Student Type">
<ItemTemplate>
<asp:DropDownList ID="ddlSTDTYPE" runat="server" Height="21px" Width="87px">
</asp:DropDownList>
<asp:Label ID="lblCategory" runat="server" Text='<%# Eval("STDTYPE") %>' Visible="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Sex">
<ItemTemplate>
<asp:DropDownList ID="ddlSex" runat="server">
</asp:DropDownList>
<asp:Label ID="lblCategory4" runat="server" Text='<%# Eval("Sex") %>' Visible="False"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="House" HeaderText="Colour" SortExpression="House" />
<asp:BoundField DataField="ACNOS" HeaderText="ACNOS" SortExpression="ACNOS" />
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
PROCEDURE [dbo].[Pushmissingstream]@c nvarchar(50) AS
truncate table streamdata
INSERT INTO streamdata ( stream )
SELECT ClassControl.Stream
FROM ClassControl LEFT JOIN Streamtrap ON ClassControl.Stream = Streamtrap.Stream
WHERE (((ClassControl.Class)=@c) AND ((Streamtrap.Stream) Is Null))
INSERT INTO streamdata ( stream )
SELECT Stream
FROM dbo.Streamtrap
WHERE (Dif > 0) and class=@c