Click here to Skip to main content
15,919,613 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P22-Dec-06 12:06
Tina P22-Dec-06 12:06 
NewsRe: Triggering the Background color, font and other properties in ASP.Net Pin
Tina P23-Dec-06 15:24
Tina P23-Dec-06 15:24 
QuestionGridview cross page data transfer Pin
srishree21-Dec-06 10:05
srishree21-Dec-06 10:05 
AnswerIf you want to use popup window for child gridview,this may help you Pin
kvPriya21-Dec-06 18:30
kvPriya21-Dec-06 18:30 
GeneralRe: If you want to use popup window for child gridview,this may help you Pin
srishree21-Dec-06 18:41
srishree21-Dec-06 18:41 
GeneralRe: If you want to use popup window for child gridview,this may help you Pin
kvPriya21-Dec-06 19:29
kvPriya21-Dec-06 19:29 
Questionflash +aspx Pin
keroed_edmond21-Dec-06 9:45
keroed_edmond21-Dec-06 9:45 
QuestionImageButton.Click event never gets fired! Pin
MY120121-Dec-06 9:08
MY120121-Dec-06 9:08 
Hi guys!

I'm creating a web application with a table containing files the users have uploaded to the site. Now for every entry in the table I have a little "trash" icon, so when clicked, the system will delete the file. Now - here is my problem: It doesn't work! Surprise huh! Wink | ;) Well it seems like the Command event of the ImageButton never gets fired. I've tried having it throw an exception, but nothing happens, the page just reposts whenever the image is clicked.

I do not use the ASP.NET data table WebControl (the one you see in almost every tutorial about ASP.NET and data access) - because it does not fit into my needs. And to be honest: I don't like it that much either.

I have this code in my ASP.NET page's CodeBehind file's Page_Load method (please don't think to much about the variable names, as some of them are in Danish):

// This code sample is part of a foreach loop, so try to imagine
// that the imgb object gets added to the current table row at the end of every loop.
// That's also why I set the .ID to "cmd" + the id for the file in the database.
// Result:
// The ImageButton turns up on the page, you can click the button, the page reposts
// and then: nada happens.

            ImageButton imgb = new ImageButton();
            imgb.CommandArgument = b.DbId.ToString();
            imgb.CommandName = "Delete";

// Attach to the Command event - or what?
// Tried with new CommandEventHandler(this.DeleteFile) - doesn't work either.
            imgb.Command += this.DeleteFile;  

            imgb.ImageUrl = "~/Images/trash.gif";
            imgb.ID = "cmd" + b.DbId.ToString();    


I have this code in the "DeleteFile" method, which matches the Delegate for the Command event:

protected void DeleteFile(object sender, CommandEventArgs e)
{
    Int32 bilagId = Int32.Parse(e.CommandArgument.ToString());
    BilagHandler.Delete(bilagId);

    throw new Exception("wtf!");

    FillBilagTable();
}


The WTF Exception never gets throwed - ergo: The code never executes! Any clues? I'm really confused.

And perhaps this post is a stupid question, but I'm just code-blind by now - hey - so be it! Smile | :)

BTW: The code compiles without any errors.

Best regards
Soeren
AnswerRe: ImageButton.Click event never gets fired! Pin
eggsovereasy21-Dec-06 9:57
eggsovereasy21-Dec-06 9:57 
GeneralRe: ImageButton.Click event never gets fired! Pin
MY120121-Dec-06 10:06
MY120121-Dec-06 10:06 
GeneralRe: ImageButton.Click event never gets fired! Pin
eggsovereasy21-Dec-06 10:40
eggsovereasy21-Dec-06 10:40 
GeneralRe: ImageButton.Click event never gets fired! Pin
MY120121-Dec-06 20:23
MY120121-Dec-06 20:23 
QuestionDraw Table Pin
Blue_Boy21-Dec-06 4:47
Blue_Boy21-Dec-06 4:47 
QuestionFrom DataTable to GridView ? Pin
aspnu21-Dec-06 4:36
aspnu21-Dec-06 4:36 
AnswerRe: From DataTable to GridView ? Pin
Christian Graus21-Dec-06 9:02
protectorChristian Graus21-Dec-06 9:02 
GeneralRe: From DataTable to GridView ? Pin
aspnu21-Dec-06 23:22
aspnu21-Dec-06 23:22 
QuestionPasswordRecovery control Pin
kss11321-Dec-06 2:50
kss11321-Dec-06 2:50 
AnswerRe: PasswordRecovery control Pin
MoustafaS21-Dec-06 4:43
MoustafaS21-Dec-06 4:43 
GeneralRe: PasswordRecovery control Pin
kss11321-Dec-06 4:50
kss11321-Dec-06 4:50 
GeneralRe: PasswordRecovery control Pin
MoustafaS21-Dec-06 5:01
MoustafaS21-Dec-06 5:01 
QuestionASP.NET File Upload Pin
sdaniel_cst21-Dec-06 2:09
sdaniel_cst21-Dec-06 2:09 
AnswerRe: ASP.NET File Upload Pin
Pete O'Hanlon21-Dec-06 2:15
mvePete O'Hanlon21-Dec-06 2:15 
GeneralRe: ASP.NET File Upload Pin
sdaniel_cst21-Dec-06 2:19
sdaniel_cst21-Dec-06 2:19 
QuestionIssue related to uploading of large files or large running process. Pin
lokeshgupta1321-Dec-06 2:01
lokeshgupta1321-Dec-06 2:01 
AnswerRe: Issue related to uploading of large files or large running process. Pin
Guffa21-Dec-06 2:58
Guffa21-Dec-06 2:58 

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.