Click here to Skip to main content
16,005,491 members
Home / Discussions / C#
   

C#

 
QuestionXML Fragment Serialization [modified] Pin
Tristan Rhodes26-Jan-07 2:01
Tristan Rhodes26-Jan-07 2:01 
AnswerRe: XML Fragment Serialization Pin
Dustin Metzgar26-Jan-07 4:42
Dustin Metzgar26-Jan-07 4:42 
GeneralRe: XML Fragment Serialization Pin
Tristan Rhodes26-Jan-07 6:08
Tristan Rhodes26-Jan-07 6:08 
GeneralRe: XML Fragment Serialization Pin
Dustin Metzgar26-Jan-07 8:04
Dustin Metzgar26-Jan-07 8:04 
GeneralRe: XML Fragment Serialization Pin
Dustin Metzgar26-Jan-07 10:40
Dustin Metzgar26-Jan-07 10:40 
QuestionDelete a row from Datagrid Pin
Bobb198226-Jan-07 1:29
Bobb198226-Jan-07 1:29 
AnswerRe: Delete a row from Datagrid Pin
Not Active26-Jan-07 2:09
mentorNot Active26-Jan-07 2:09 
AnswerRe: Delete a row from Datagrid Pin
NKandwal26-Jan-07 2:17
NKandwal26-Jan-07 2:17 
hi,

first of all create a template column , add an imagebutton on that and set Command Name property of that imagename as Delete. Defind DataKey of the datagrid as whatever ID or Field you want to use to delete the record from DB. Now write the follwing code:

private void DataGrid1_DeleteCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
try
{
int ID = Convert.ToInt32(DataGridInventory.DataKeys[e.Item.ItemIndex]);

//Pass this ID to the stored procedure where you have to write delete query.
or
SqlConnection con=new SqlConnection("<connectioname>");
con.Open();
SqlCommand cmd=new SqlCommand();
cmd.CommandText="delete form Table1 where id="
+ID";
cmd.Connection=con;
cmd.ExecuteNonQuery();
con.Close();
}
catch(Exception ex)
{
con.Close();
string strMsg=ex.Message;
}


}
GeneralRe: Delete a row from Datagrid [modified] Pin
Bobb198227-Jan-07 20:03
Bobb198227-Jan-07 20:03 
QuestionFor all brainy ones and exclusively for bobsugar222 Pin
Saira Tanwir26-Jan-07 1:20
Saira Tanwir26-Jan-07 1:20 
AnswerRe: For all brainy ones and exclusively for bobsugar222 Pin
Shajeel26-Jan-07 1:31
Shajeel26-Jan-07 1:31 
GeneralRe: For all brainy ones and exclusively for bobsugar222 Pin
Saira Tanwir26-Jan-07 1:34
Saira Tanwir26-Jan-07 1:34 
AnswerRe: For all brainy ones and exclusively for bobsugar222 Pin
Pete O'Hanlon26-Jan-07 1:34
mvePete O'Hanlon26-Jan-07 1:34 
AnswerRe: For all brainy ones and exclusively for bobsugar222 Pin
bobsugar22226-Jan-07 4:25
bobsugar22226-Jan-07 4:25 
Questionstrange error in DataGridView Control windows Forms Pin
Rocky#26-Jan-07 0:50
Rocky#26-Jan-07 0:50 
AnswerRe: strange error in DataGridView Control windows Forms Pin
t4ure4n26-Jan-07 4:34
t4ure4n26-Jan-07 4:34 
GeneralRe: strange error in DataGridView Control windows Forms Pin
Rocky#27-Jan-07 1:30
Rocky#27-Jan-07 1:30 
AnswerRe: strange error in DataGridView Control windows Forms Pin
Drew McGhie26-Jan-07 5:13
Drew McGhie26-Jan-07 5:13 
GeneralRe: strange error in DataGridView Control windows Forms Pin
Rocky#27-Jan-07 1:23
Rocky#27-Jan-07 1:23 
Questionautoscalling.... Pin
quiteSmart26-Jan-07 0:04
quiteSmart26-Jan-07 0:04 
QuestionLogging into a site Pin
sharpiesharpie26-Jan-07 0:03
sharpiesharpie26-Jan-07 0:03 
AnswerRe: Logging into a site Pin
Pete O'Hanlon26-Jan-07 1:56
mvePete O'Hanlon26-Jan-07 1:56 
GeneralRe: Logging into a site Pin
sharpiesharpie26-Jan-07 2:35
sharpiesharpie26-Jan-07 2:35 
AnswerRe: Logging into a site Pin
Ravi Bhavnani26-Jan-07 4:18
professionalRavi Bhavnani26-Jan-07 4:18 
GeneralRe: Logging into a site Pin
sharpiesharpie26-Jan-07 4:39
sharpiesharpie26-Jan-07 4:39 

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.