manish berwal

manish berwal

  • NA
  • 29
  • 13k

want coding for my Show Records button (button1).

Apr 22 2013 4:56 AM
hello every1,i have a aspx page and i want coding for button1(name-Show Records) on the behalf of selecting values by dropdownlist1 and dropdownlist4.... i am uploading my aspx page with this ....thnx in advance.
----------------------------------
---------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="show.aspx.cs" Inherits="fixed_deposit.show" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
  <title>Untitled Page</title>
  <style type="text/css">
  .style1
  {
  width: 72%;
  background-color: #66CCFF;
  }
  .style2
  {
  width: 157px;
  }
  .style3
  {
  width: 459px;
  }
  </style>
</head>
<body>
  <form id="form1" runat="server">
  <div>
 
  <td align ="center" colspan="4"><span style="font-size: 25px;"><strong>Show Record</strong></span></td></div>
  <table class="style1">
  <tr>
  <td class="style2">
  Block Name</td>
  <td class="style3">
  <asp:DropDownList ID="DropDownList1" runat="server"
  DataSourceID="SqlDataSource1" DataTextField="block_name"
  DataValueField="block_code" AutoPostBack="true">
  </asp:DropDownList>
 
  <asp:SqlDataSource ID="SqlDataSource1" runat="server"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString3 %>"
  SelectCommand="SELECT [block_code], [block_name] FROM [block]">
  </asp:SqlDataSource> 
  <br />
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  Department Name</td>
  <td class="style3">
  <asp:DropDownList ID="DropDownList2" runat="server"
  DataSourceID="SqlDataSource2" DataTextField="dept_name"
  DataValueField="dept_address" ondatabound="mylist1">
  </asp:DropDownList>
  <br />
  <asp:SqlDataSource ID="SqlDataSource2" runat="server"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString4 %>"
  SelectCommand="SELECT [dept_name], [dept_address] FROM [dept]">
  </asp:SqlDataSource>
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  GP/Owner Name</td>
  <td class="style3">
  <asp:TextBox ID="TextBox1" runat="server" Width="177px"></asp:TextBox>
  <br />
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  Village Name</td>
  <td class="style3">
  <asp:DropDownList ID="DropDownList4" runat="server"
  DataSourceID="SqlDataSource4" DataTextField="vill_name"
  DataValueField="vill_code" />
  </asp:DropDownList>
 
  <asp:SqlDataSource ID="SqlDataSource4" runat="server"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString6 %>"
  SelectCommand="SELECT vill_name, vill_code FROM village WHERE (block_code = @block_code) ORDER BY vill_name">
  <SelectParameters>
  <asp:ControlParameter ControlID="DropDownList1" Name="block_code"
  PropertyName="SelectedValue" Type="String" />
  </SelectParameters>
  </asp:SqlDataSource>
  <br />
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  Bank Name</td>
  <td class="style3">
  <asp:DropDownList ID="DropDownList5" runat="server"
  DataSourceID="SqlDataSource5" DataTextField="BankName" DataValueField="SrNo">
  </asp:DropDownList>
  <asp:SqlDataSource ID="SqlDataSource5" runat="server"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString7 %>"
  SelectCommand="SELECT [BankName], [SrNo] FROM [bank]"></asp:SqlDataSource>
  <br />
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  Branch Name</td>
  <td class="style3">
  <asp:DropDownList ID="DropDownList6" runat="server"
  DataSourceID="SqlDataSource6" DataTextField="Branch" DataValueField="SrNo">
  </asp:DropDownList>
  <asp:SqlDataSource ID="SqlDataSource6" runat="server"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString8 %>"
  SelectCommand="SELECT [Branch], [SrNo] FROM [Branch]"></asp:SqlDataSource>
  <br />
  </td>
  <td>
  &nbsp;</td>
  </tr>
  <tr>
  <td class="style2">
  &nbsp;</td>
  <td class="style3">
  <asp:Button ID="Button1" runat="server" Text="Show Records" Width="186px"
  onclick="Button1_Click" />
  </td>
  <td>
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</td>
  </tr>
  </table>
  <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
  AllowSorting="True" BackColor="White" BorderColor="#336666"
  BorderStyle="Double" BorderWidth="3px" CellPadding="4"
  DataSourceID="SqlDataSource7" GridLines="Horizontal">
  <FooterStyle BackColor="White" ForeColor="#333333" />
  <RowStyle BackColor="White" ForeColor="#333333" />
  <Columns>
  <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
  </Columns>
  <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
  <SelectedRowStyle BackColor="#339966" Font-Bold="True" ForeColor="White" />
  <HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" />
  </asp:GridView>
  <asp:SqlDataSource ID="SqlDataSource7" runat="server"
  ConflictDetection="CompareAllValues"
  ConnectionString="<%$ ConnectionStrings:fdConnectionString16 %>"
  DeleteCommand="DELETE FROM [main] WHERE [sr_no] = @original_sr_no AND [block_name] = @original_block_name AND [dept_name] = @original_dept_name AND [gp_ownername] = @original_gp_ownername AND [vill_name] = @original_vill_name AND [fd_amount] = @original_fd_amount AND [fd_startdate] = @original_fd_startdate AND [fd_period] = @original_fd_period AND [roi] = @original_roi AND [bank_name] = @original_bank_name AND [branch] = @original_branch AND [remarks] = @original_remarks"
  InsertCommand="INSERT INTO [main] ([block_name], [dept_name], [gp_ownername], [vill_name], [fd_amount], [fd_startdate], [fd_period], [roi], [bank_name], [branch], [remarks]) VALUES (@block_name, @dept_name, @gp_ownername, @vill_name, @fd_amount, @fd_startdate, @fd_period, @roi, @bank_name, @branch, @remarks)"
  OldValuesParameterFormatString="original_{0}"
  SelectCommand="SELECT * FROM [main]"
  UpdateCommand="UPDATE [main] SET [block_name] = @block_name, [dept_name] = @dept_name, [gp_ownername] = @gp_ownername, [vill_name] = @vill_name, [fd_amount] = @fd_amount, [fd_startdate] = @fd_startdate, [fd_period] = @fd_period, [roi] = @roi, [bank_name] = @bank_name, [branch] = @branch, [remarks] = @remarks WHERE [sr_no] = @original_sr_no AND [block_name] = @original_block_name AND [dept_name] = @original_dept_name AND [gp_ownername] = @original_gp_ownername AND [vill_name] = @original_vill_name AND [fd_amount] = @original_fd_amount AND [fd_startdate] = @original_fd_startdate AND [fd_period] = @original_fd_period AND [roi] = @original_roi AND [bank_name] = @original_bank_name AND [branch] = @original_branch AND [remarks] = @original_remarks">
  <DeleteParameters>
  <asp:Parameter Name="original_sr_no" Type="Int32" />
  <asp:Parameter Name="original_block_name" Type="String" />
  <asp:Parameter Name="original_dept_name" Type="String" />
  <asp:Parameter Name="original_gp_ownername" Type="String" />
  <asp:Parameter Name="original_vill_name" Type="String" />
  <asp:Parameter Name="original_fd_amount" Type="Int64" />
  <asp:Parameter Name="original_fd_startdate" Type="DateTime" />
  <asp:Parameter Name="original_fd_period" Type="String" />
  <asp:Parameter Name="original_roi" Type="String" />
  <asp:Parameter Name="original_bank_name" Type="String" />
  <asp:Parameter Name="original_branch" Type="String" />
  <asp:Parameter Name="original_remarks" Type="String" />
  </DeleteParameters>
  <UpdateParameters>
  <asp:Parameter Name="block_name" Type="String" />
  <asp:Parameter Name="dept_name" Type="String" />
  <asp:Parameter Name="gp_ownername" Type="String" />
  <asp:Parameter Name="vill_name" Type="String" />
  <asp:Parameter Name="fd_amount" Type="Int64" />
  <asp:Parameter Name="fd_startdate" Type="DateTime" />
  <asp:Parameter Name="fd_period" Type="String" />
  <asp:Parameter Name="roi" Type="String" />
  <asp:Parameter Name="bank_name" Type="String" />
  <asp:Parameter Name="branch" Type="String" />
  <asp:Parameter Name="remarks" Type="String" />
  <asp:Parameter Name="original_sr_no" Type="Int32" />
  <asp:Parameter Name="original_block_name" Type="String" />
  <asp:Parameter Name="original_dept_name" Type="String" />
  <asp:Parameter Name="original_gp_ownername" Type="String" />
  <asp:Parameter Name="original_vill_name" Type="String" />
  <asp:Parameter Name="original_fd_amount" Type="Int64" />
  <asp:Parameter Name="original_fd_startdate" Type="DateTime" />
  <asp:Parameter Name="original_fd_period" Type="String" />
  <asp:Parameter Name="original_roi" Type="String" />
  <asp:Parameter Name="original_bank_name" Type="String" />
  <asp:Parameter Name="original_branch" Type="String" />
  <asp:Parameter Name="original_remarks" Type="String" />
  </UpdateParameters>
  <InsertParameters>
  <asp:Parameter Name="block_name" Type="String" />
  <asp:Parameter Name="dept_name" Type="String" />
  <asp:Parameter Name="gp_ownername" Type="String" />
  <asp:Parameter Name="vill_name" Type="String" />
  <asp:Parameter Name="fd_amount" Type="Int64" />
  <asp:Parameter Name="fd_startdate" Type="DateTime" />
  <asp:Parameter Name="fd_period" Type="String" />
  <asp:Parameter Name="roi" Type="String" />
  <asp:Parameter Name="bank_name" Type="String" />
  <asp:Parameter Name="branch" Type="String" />
  <asp:Parameter Name="remarks" Type="String" />
  </InsertParameters>
  </asp:SqlDataSource>
  <br />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="Button2" runat="server"
  Text="Main Page" onclick="Button2_Click" />
  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="Button3" runat="server"
  Text="Close" OnClick="Button3_Click" />
  </form>
  </body>
</html>