Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELETE * FROM Portfolio WHERE PortfolioID = @PortfolioID
- <asp:GridView ID="myGrid" runat="server" DataKeyNames='PortfolioID' OnRowCommand="dgStudent_RowCommand">
- <Columns>
- <asp:ButtonField ButtonType="Button" CommandName="Delete" Text="Delete"></asp:ButtonField>
- </Columns>
- </asp:GridView>
- protected void myGrid_RowCommand(object sender, GridViewCommandEventArgs e)
- {
- // create and open DB connection
- int PortfolioID = (int)myGrid.DataKeys[Convert.ToInt32(e.CommandArgument)].Value;
- DeleteRow(PortfolioID); // your implementation
- myGrid.DataBind();
- }
- private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- this.txt_portfolioId.Text=dataGridView1.CurrentRow.Cells["portfolioID"].Value.ToString();
- }
- private void btn_Delete(object sender, EventArgs e)
- {
- //You need to connect to database(regular database connection this connection string and sqlcommand and add this sqlquerry:
Add Comment
Please, Sign In to add comment