Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

How do i use updatepanel in asp.net for fetch data from database?

$
0
0
I wan to make a forum Web-site. When any body post his view, then he can see his post after click on Insert.
My code is
<body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><h1>Which Browser you are using? and WHY?</h1><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:DataList ID="DataList1" runat="server" BorderStyle="Solid" 
                BorderWidth="3px" DataSourceID="SqlDataSource2" GridLines="Horizontal" 
                Height="500px" Width="600px"><ItemTemplate>
                    Name:<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' /><br /><br /></ItemTemplate></asp:DataList><trigger></ContentTemplate></asp:UpdatePanel><asp:SqlDataSource ID="SqlDataSource2" runat="server" 
                ConnectionString="<%$ ConnectionStrings:edcallsConnectionString2 %>" 
                SelectCommand="SELECT [name] FROM [plus]"></asp:SqlDataSource><asp:UpdatePanel ID="UpdatePanel2" runat="server"  UpdateMode="Always" ChildrenAsTriggers="true"><ContentTemplate><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                ConnectionString="<%$ ConnectionStrings:edcallsConnectionString %>" 
                SelectCommand="SELECT * FROM [plus]" 
                DeleteCommand="DELETE FROM [plus] WHERE [id] = @id" 
                InsertCommand="INSERT INTO [plus] ([name]) VALUES (@name)" 
                UpdateCommand="UPDATE [plus] SET [name] = @name WHERE [id] = @id"><DeleteParameters><asp:Parameter Name="id" Type="Int32" /></DeleteParameters><InsertParameters><asp:Parameter Name="name" Type="String" /></InsertParameters><UpdateParameters><asp:Parameter Name="name" Type="String" /><asp:Parameter Name="id" Type="Int32" /></UpdateParameters></asp:SqlDataSource><br /><br /><asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True"
                AutoGenerateInsertButton="True" AutoGenerateRows="False" BorderStyle="Ridge" 
                BorderWidth="2px" Caption="Post Your View" CaptionAlign="Top" 
                DataSourceID="SqlDataSource1" DefaultMode="Insert" Font-Names="BatangChe" 
                Font-Size="Larger" Height="100px" Width="100px" DataKeyNames="id" 
                    BackColor="White" BorderColor="White" CellPadding="3" CellSpacing="1" 
                    GridLines="None"><EditRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White"/><Fields><asp:BoundField DataField="id" HeaderText="id" SortExpression="id" 
                        InsertVisible="False" ReadOnly="True"/><asp:BoundField DataField="name" HeaderText="Name" SortExpression="name"/></Fields><FooterStyle BackColor="#C6C3C6" ForeColor="Black" /><HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" /><PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" /><RowStyle BackColor="#DEDFDE" ForeColor="Black" /></asp:DetailsView></ContentTemplate></asp:UpdatePanel><br /></div></body>
</html


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>