tr raj

tr raj

  • NA
  • 1
  • 0

gridview custom delete button mysql database connection string with delete command in vb

Feb 6 2010 6:31 AM

Hello Experts....
My query is i am using mysql database its been connected with grid view and in that i inserted custom delete button with java script for confirmation(are you sure, want to delete this record). with checked checkbox
but i don't know how and where to use the delete command in the  vb code
here is my code
where to insert my delete command to delete?
any help will be really helpful
with kind regards
<%
@ Page Language="VB"  AutoEventWireup="false" CodeFile="data.aspx.vb" Inherits="data" %>
<!
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>Data</title>
</
head>
<
script type="text/javascript" language="javascript">
function
DeleteConfirmation()
{

if
(confirm("Are you sure, you want to delete selected records ?")==true)
return true;
else

return false;
}

</
script>
<
body>
<form id="form1" runat="server">
<div>
&nbsp;<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False"
DataSourceID="ObjectDataSource1"
ShowFooter="True" CellPadding="4" ForeColor="#333333" GridLines="None" AllowPaging="True">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="recordselector" runat="server" OnCheckedChanged="chkSelect_CheckedChanged" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="SNo"
HeaderText="SNo"
SortExpression="SNo" />
<asp:BoundField DataField="Title_and_Scope_of_the_R_and_D_project"
HeaderText="Title and Scope of the R&amp;D project"
SortExpression="Title_and_Scope_of_the_R_and_D_project" />
<asp:BoundField DataField="Name_of_the_Project_Leader"
HeaderText="Name of the Project Leader"
SortExpression="Name_of_the_Project_Leader" />
<asp:BoundField DataField="Source_of_funding_and_started_year"
HeaderText="Source of funding and started year"
SortExpression="Source_of_funding_and_started_year" />
<asp:BoundField DataField="Duration"
HeaderText="Duration"
SortExpression="Duration" />
<asp:BoundField DataField="Capital_Rs_in_lakhs"
HeaderText="Capital Rs.(in lakhs)"
SortExpression="Capital_Rs_in_lakhs" />
<asp:BoundField DataField="Recurring_Rs_in_lakhs"
HeaderText="Recurring Rs.(in lakhs)"
SortExpression="Recurring_Rs_in_lakhs" />
<asp:BoundField DataField="Total_Rs_in_lakhs"
HeaderText="Total Rs. (in lakhs)"
SortExpression="Total_Rs_in_lakhs" />
<asp:BoundField DataField="F_E"
HeaderText="F.E"
SortExpression="F_E" />
<asp:BoundField DataField="Remarks"
HeaderText="Remarks"
SortExpression="Remarks" />
</Columns>
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

</
asp:GridView>
<asp:ObjectDataSource ID="ObjectDataSource1" runat="server" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
TypeName="prodataTableAdapters.proposedTableAdapter">
</asp:ObjectDataSource>
<asp:Button ID="delbutton" runat="server" Text="Delete"
OnClick="delbutton_Click" CommandName="Delete" Height="32px" Width="88px"/><br />
<br />
</div>
</form>
</
body>
</
html>