To solve this exception do these:-
protected void gvManageProducts_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
//required -do not remove
}
and also write this:-
protected void gvManageProducts_SelectedIndexChanged(object sender, EventArgs e)
{
//required -do not remove
}
Google Brother Up
2008/02/21
2008/02/20
Pass a String (List) to a Stored Procedure and Update
ALTER PROCEDURE [dbo].[sprocUpdateStatusInProductMaster]
@List nvarchar(4000) -- value assigned to @List from DataLayer
AS
BEGIN
declare @ProdId2 int;
declare @Status2 nvarchar(100);
declare @CountRows int;
mailto:declare@val int;
declare @i int;
set @i = 1;
-- format of @List is @List = {1,True;2,False;3,True;4,False;5,False;}
-- execute sprocUpdateStatusInProductMaster ';1,True;2,False;3,True;4,False;5,False;'
set @List = ltrim(rtrim(Substring(@List,CharIndex(';',@List)+1,Len(@List)))); -- to eliminate the first semicolon ;
while(len(@List)>0)
BEGIN
set @ProdId2 = ltrim(rtrim(Substring(@List,1,CharIndex(',',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@ProdId2)+2,len(@List))));
set @Status2 = ltrim(rtrim(Substring(@List,1,CharIndex(';',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@Status2)+2,len(@List))));
update tblProductMaster set IsActive = @Status2
where ProductID = @ProdId2;
END
END
@List nvarchar(4000) -- value assigned to @List from DataLayer
AS
BEGIN
declare @ProdId2 int;
declare @Status2 nvarchar(100);
declare @CountRows int;
mailto:declare@val int;
declare @i int;
set @i = 1;
-- format of @List is @List = {1,True;2,False;3,True;4,False;5,False;}
-- execute sprocUpdateStatusInProductMaster ';1,True;2,False;3,True;4,False;5,False;'
set @List = ltrim(rtrim(Substring(@List,CharIndex(';',@List)+1,Len(@List)))); -- to eliminate the first semicolon ;
while(len(@List)>0)
BEGIN
set @ProdId2 = ltrim(rtrim(Substring(@List,1,CharIndex(',',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@ProdId2)+2,len(@List))));
set @Status2 = ltrim(rtrim(Substring(@List,1,CharIndex(';',@List)-1)));
set @List = ltrim(rtrim(Substring(@List,len(@Status2)+2,len(@List))));
update tblProductMaster set IsActive = @Status2
where ProductID = @ProdId2;
END
END
Label to Integer
Label lbl = (Label)gvManageProducts.Rows[i].FindControl("lblProductId");
int lblint = Int32.Parse(lbl.Text);
int lblint = Int32.Parse(lbl.Text);
Subscribe to:
Posts (Atom)
Drop Down List
1. http://www.janetsystems.co.uk/Articles/NetArticles/tabid/74/itemid/161/modid/449/Default.aspx