error comes when i try to bind gridview.
System.InvalidOperationException: 'Only one instance of a ScriptManager can be added to the page.'
Private Sub BindGrid()
Dim cmd As New SqlCommand("SELECT Name,class as Classr,class,stream, House, ACNOS,admno,Sex,STDTYPE,Autofield FROM STUDENT")
Stockbooks.DataSource = Me.ExecuteQuery(cmd, "SELECT")
Stockbooks.DataBind()
Stockbooks.UseAccessibleHeader = True
Stockbooks.HeaderRow.TableSection = TableRowSection.TableHeader
End Sub
<body>
<form id="form1" runat="server">
<div class="auto-style1">
<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*=Stockbooks]").DataTable(
{
bLengthChange: true,
lengthMenu: [[15, 20, -1], [15, 20, "All"]],
bFilter: true,
bSort: true,
bPaginate: true
});
});
</script>
<div>
<asp:GridView ID="Stockbooks" runat="server" AutoGenerateColumns="False" OnRowDataBound="OnRowDataBound" CssClass="w3-table-all w3-hoverable"
HeaderStyle-BackColor="#FFCCCC" Width="50%" ClientIDMode="Static" Height="10px" ShowFooter = "True">
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkAll" runat="server" AutoPostBack="true" OnCheckedChanged="OnCheckedChanged"/>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="CheckBox" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField Visible="False">
<ItemTemplate>
<asp:Label ID="admno" runat="server" Text='<%#Eval("admno")%>'>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
HeaderText="Admno">
<FooterTemplate>
<asp:Button ID="Button1" runat="server" Text="AddNew Student" />
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Name" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("admno")%>'>
</asp:Label>
</ItemTemplate>
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
HeaderText="Student Names">
<FooterTemplate>
<asp:TextBox ID="Fnames" runat="server" Width="221px"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Class" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("Name") %>'>
</asp:Label>
</ItemTemplate>
<ControlStyle Width="250px" />
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
<ItemStyle Width="50px" />
</asp:TemplateField>
<asp:TemplateField HeaderText = "Class">
<FooterTemplate>
<asp:DropDownList ID="ddlclasses" runat="server">
<asp:ListItem>ALL</asp:ListItem>
<asp:ListItem>PRE</asp:ListItem>
<asp:ListItem>P1</asp:ListItem>
<asp:ListItem>P2</asp:ListItem>
<asp:ListItem>P3</asp:ListItem>
<asp:ListItem>P4</asp:ListItem>
<asp:ListItem>P5</asp:ListItem>
<asp:ListItem>P6</asp:ListItem>
<asp:ListItem>P7</asp:ListItem>
<asp:ListItem>S1</asp:ListItem>
<asp:ListItem>S2</asp:ListItem>
<asp:ListItem>S3</asp:ListItem>
<asp:ListItem>S4</asp:ListItem>
<asp:ListItem>S5</asp:ListItem>
<asp:ListItem>S6</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblCountry" runat="server" Text='<%# Eval("Class") %>' Visible = "False" />
<asp:DropDownList ID="ddlclasses" runat="server">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField >
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black" HeaderText="Stream">
<FooterTemplate>
<asp:DropDownList ID="ddlstream" runat="server" DataSourceID="SqlDataSource1" DataTextField="Stream" DataValueField="Stream">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:STOREConnectionString1 %>" SelectCommand="SELECT [Stream] FROM [Streams]"></asp:SqlDataSource>
</FooterTemplate>
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="ddlstream" runat="server">
</asp:DropDownList>
<asp:Label ID="Lblstream" runat="server" Text='<%# Eval("Stream") %>' Visible="False"></asp:Label>
<asp:ScriptManager ID="ScriptManager" runat="server" EnablePartialRendering="False">
</asp:ScriptManager>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="ddlstream" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
</ItemTemplate>
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black" HeaderText="Sex">
<FooterTemplate>
<asp:DropDownList ID="ddlsex" runat="server">
<asp:ListItem>MALE</asp:ListItem>
<asp:ListItem>FEMALE</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblsex" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px" />
<asp:Label ID="Lblsexd" runat="server" Text='<%# Eval("Sex").ToString() %>' Visible="False"></asp:Label>
<asp:DropDownList ID="ddlsex" runat="server">
</asp:DropDownList>
</ItemTemplate>
<ControlStyle Width="100px"></ControlStyle>
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="Black" />
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
HeaderText="STDTYPE">
<FooterTemplate>
<asp:DropDownList ID="ddlstdtype" runat="server">
<asp:ListItem>ALL</asp:ListItem>
<asp:ListItem>New</asp:ListItem>
<asp:ListItem>Old</asp:ListItem>
<asp:ListItem>OldRepeater</asp:ListItem>
</asp:DropDownList>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="lblstdtype" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px" Text='<%# Eval("STDTYPE") %>' Visible="False"></asp:Label>
<asp:DropDownList ID="ddlstdtype" runat="server">
</asp:DropDownList>
</ItemTemplate>
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="Black"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
HeaderText="Colour">
<FooterTemplate>
<asp:TextBox ID="Fcolour" runat="server"></asp:TextBox>
</FooterTemplate>
<ItemTemplate>
<asp:Label ID="Colour" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("House") %>'>
</asp:Label>
</ItemTemplate>
<ControlStyle Width="100px" />
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="Black"></HeaderStyle>
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black" HeaderText="ACNOS"
Visible="false">
<ItemTemplate>
<asp:Label ID="ACNOS" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("ACNOS") %>'>
</asp:Label>
</ItemTemplate>
<ControlStyle Width="100px" />
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblreminder" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("Classr") %>'>
</asp:Label>
</ItemTemplate>
<ControlStyle Width="100px" />
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
</asp:TemplateField>
<asp:TemplateField HeaderStyle-Font-Names="Arial" HeaderStyle-Font-Size="12px" HeaderStyle-ForeColor="Black"
Visible="false">
<ItemTemplate>
<asp:Label ID="lblpo" runat="server" Font-Bold="True" Font-Names="Arial" Font-Size="12px"
Text='<%#Eval("autofield") %>'>
</asp:Label>
</ItemTemplate>
<ControlStyle Width="100px" />
<HeaderStyle Font-Names="Arial" Font-Size="12px" ForeColor="white" />
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
No Record Available
</EmptyDataTemplate>
<HeaderStyle BackColor="#4dc3ff" />
</asp:GridView>
</div>
</div>
</form>
</body>
</html>