Click here to Skip to main content
16,011,805 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: storing text of textboxes in list ang show them in textbox again(in gridview) Pin
strawberrysh5-Sep-08 19:39
strawberrysh5-Sep-08 19:39 
Questionjavascript Script Error: Expected ')' in Asp.net Pin
Rajeshwary5-Sep-08 8:30
Rajeshwary5-Sep-08 8:30 
AnswerRe: javascript Script Error: Expected ')' in Asp.net Pin
Bassam Saoud5-Sep-08 11:18
Bassam Saoud5-Sep-08 11:18 
GeneralRe: javascript Script Error: Expected ')' in Asp.net Pin
NeverHeardOfMe5-Sep-08 11:56
NeverHeardOfMe5-Sep-08 11:56 
GeneralRe: javascript Script Error: Expected ')' in Asp.net Pin
Rajeshwary5-Sep-08 21:25
Rajeshwary5-Sep-08 21:25 
GeneralRe: javascript Script Error: Expected ')' in Asp.net Pin
Guffa6-Sep-08 0:12
Guffa6-Sep-08 0:12 
Questiondeleting a row of gridview and the id of product from a list Pin
strawberrysh5-Sep-08 7:12
strawberrysh5-Sep-08 7:12 
AnswerRe: deleting a row of gridview and the id of product from a list Pin
Gayani Devapriya5-Sep-08 7:34
Gayani Devapriya5-Sep-08 7:34 
Hi,


For the GridViews RowDeleting event, access the ID and remove it.
Here is the steps to follow. After successful deletion re-bind the list to the GridView control.

1. For the delete button, set CommandArgument as the ID.
<asp:Button ID="btnDelete" runat="server" CommandName="delete" CommandArgument='<%#Eval("product_id")%'> />

2. For the RowDeleting event.
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
Button btnDelete = (Button)GridView1.Rows[e.RowIndex].FindControl("btnDelete");
if (btnDelete != null)
{
int iProductID = Int32.Parse(btnDelete.CommandArgument);
if (Session["lstProduct"] != null)
{
List<Products> lstProducts = (List<Products> )Session["lstProduct"];
Products oProducts = lstProducts.Find(delegate(Products p) { return p.product_id == iProductID; });
if (oProducts != null)
{
//Give a message : record deleted successfully.
lstProducts.Remove(oProducts);
Session["lstProduct"] = lstProducts;
GridView1.DataSource = lstProducts;
GridView1.DataBind();
}
}
}
}
Hope it helps,
Thx,
Gayani
GeneralRe: deleting a row of gridview and the id of product from a list [modified] Pin
strawberrysh5-Sep-08 9:19
strawberrysh5-Sep-08 9:19 
Questionajax tab panel and datagrid Pin
vjvjvjvj5-Sep-08 5:21
vjvjvjvj5-Sep-08 5:21 
Questionsql query for dropdownlist Pin
eyeseetee5-Sep-08 4:02
eyeseetee5-Sep-08 4:02 
AnswerRe: sql query for dropdownlist Pin
Dilip H. Patel5-Sep-08 4:17
Dilip H. Patel5-Sep-08 4:17 
AnswerRe: sql query for dropdownlist Pin
Blue_Boy5-Sep-08 4:19
Blue_Boy5-Sep-08 4:19 
GeneralRe: sql query for dropdownlist Pin
eyeseetee5-Sep-08 4:37
eyeseetee5-Sep-08 4:37 
GeneralRe: sql query for dropdownlist Pin
Blue_Boy5-Sep-08 4:41
Blue_Boy5-Sep-08 4:41 
GeneralRe: sql query for dropdownlist Pin
eyeseetee5-Sep-08 4:49
eyeseetee5-Sep-08 4:49 
GeneralRe: sql query for dropdownlist Pin
Blue_Boy5-Sep-08 4:53
Blue_Boy5-Sep-08 4:53 
GeneralRe: sql query for dropdownlist Pin
eyeseetee5-Sep-08 5:11
eyeseetee5-Sep-08 5:11 
GeneralRe: sql query for dropdownlist Pin
Blue_Boy5-Sep-08 5:13
Blue_Boy5-Sep-08 5:13 
GeneralRe: sql query for dropdownlist Pin
AprNgp5-Sep-08 7:13
AprNgp5-Sep-08 7:13 
GeneralRe: sql query for dropdownlist Pin
Blue_Boy5-Sep-08 7:22
Blue_Boy5-Sep-08 7:22 
Questionwindow popup on textbox textchanged Pin
kishorg15-Sep-08 2:48
kishorg15-Sep-08 2:48 
Questiongetting image from scripts Pin
rohit tiwary5-Sep-08 2:22
rohit tiwary5-Sep-08 2:22 
Questioncalling ASP function Pin
The Web Developer5-Sep-08 1:42
The Web Developer5-Sep-08 1:42 
AnswerRe: calling ASP function Pin
ToddHileHoffer5-Sep-08 2:21
ToddHileHoffer5-Sep-08 2:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.