Click here to Skip to main content
15,920,005 members
Home / Discussions / ASP.NET
   

ASP.NET

 
AnswerClassic ASP - Prevent Cache from being stored Pin
diegosendra29-Oct-12 18:26
diegosendra29-Oct-12 18:26 
SuggestionRe: Classic ASP - Prevent Cache from being stored Pin
Eddy Vluggen30-Oct-12 3:32
professionalEddy Vluggen30-Oct-12 3:32 
GeneralRe: Classic ASP - Prevent Cache from being stored Pin
diegosendra30-Oct-12 4:49
diegosendra30-Oct-12 4:49 
GeneralRe: Classic ASP - Prevent Cache from being stored Pin
diegosendra30-Oct-12 7:07
diegosendra30-Oct-12 7:07 
GeneralRe: Classic ASP - Prevent Cache from being stored Pin
Eddy Vluggen30-Oct-12 10:21
professionalEddy Vluggen30-Oct-12 10:21 
QuestionTNS:address already in use Exception Pin
sjdavy29-Oct-12 9:36
sjdavy29-Oct-12 9:36 
QuestionEvent not working with ParseControl method Pin
Akshay Lakhmani28-Oct-12 21:46
Akshay Lakhmani28-Oct-12 21:46 
AnswerRe: Event not working with ParseControl method Pin
Ashish Raj Srivastava29-Oct-12 9:20
Ashish Raj Srivastava29-Oct-12 9:20 
you need to add command event handler for this:
try this:


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class dynamicimage : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string str = @"<asp:ImageButton ID=""dynoimage"" ImageUrl=""~/images/about01.jpg"" runat=""server"" oncommand=""clickme"" commandname=""btn"" />";
        Control c = ParseControl(str);
        form1.Controls.Add(c);
        ((ImageButton)Page.FindControl("dynoimage")).Command += new CommandEventHandler(clickme);
    }

    protected void clickme(object sender,CommandEventArgs e)
    {
        Response.Write("Image clicked");
        Label1.Text = "Image clicked";
    }
}



and here is the aspx page:

XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="dynamicimage.aspx.cs" Inherits="dynamicimage" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <p>
        <asp:Label ID="Label1" runat="server" Text="before click"></asp:Label>
    </p>
    </form>
</body>
</html>

GeneralRe: Event not working with ParseControl method Pin
Akshay Lakhmani29-Oct-12 18:08
Akshay Lakhmani29-Oct-12 18:08 
Question51degrees not redirecting! Pin
Jassim Rahma28-Oct-12 3:31
Jassim Rahma28-Oct-12 3:31 
QuestionIsMobile not determining mobile! Pin
Jassim Rahma26-Oct-12 8:42
Jassim Rahma26-Oct-12 8:42 
AnswerRe: IsMobile not determining mobile! Pin
Vasudevan Deepak Kumar26-Oct-12 8:57
Vasudevan Deepak Kumar26-Oct-12 8:57 
AnswerRe: IsMobile not determining mobile! Pin
jkirkerx26-Oct-12 12:19
professionaljkirkerx26-Oct-12 12:19 
QuestionCalculator App using Workflow Foundation in .net 4.0 Pin
Prasyee26-Oct-12 2:11
Prasyee26-Oct-12 2:11 
Questionautomatically generate sitemap Pin
Jassim Rahma26-Oct-12 1:19
Jassim Rahma26-Oct-12 1:19 
AnswerRe: automatically generate sitemap Pin
Vasudevan Deepak Kumar26-Oct-12 3:24
Vasudevan Deepak Kumar26-Oct-12 3:24 
QuestionBest SPF Practice Pin
Jassim Rahma25-Oct-12 9:51
Jassim Rahma25-Oct-12 9:51 
AnswerRe: Best SPF Practice Pin
Vasudevan Deepak Kumar26-Oct-12 3:23
Vasudevan Deepak Kumar26-Oct-12 3:23 
AnswerRe: Best SPF Practice Pin
jkirkerx26-Oct-12 10:52
professionaljkirkerx26-Oct-12 10:52 
QuestionStop Running Script Error Pin
ashu200124-Oct-12 23:12
ashu200124-Oct-12 23:12 
AnswerRe: Stop Running Script Error Pin
Vasudevan Deepak Kumar26-Oct-12 3:25
Vasudevan Deepak Kumar26-Oct-12 3:25 
QuestionTips on asp.net data updates and third party framework Pin
jumbojs23-Oct-12 19:20
jumbojs23-Oct-12 19:20 
AnswerRe: Tips on asp.net data updates and third party framework Pin
David Mujica24-Oct-12 3:22
David Mujica24-Oct-12 3:22 
Questionin Asp.net How to add templatefield and itemtemplate field dynamically in grid view please tell me...... Pin
ShreeGaneshPatil198822-Oct-12 20:59
ShreeGaneshPatil198822-Oct-12 20:59 
AnswerRe: in Asp.net How to add templatefield and itemtemplate field dynamically in grid view please tell me...... Pin
Sandeep Mewara23-Oct-12 4:13
mveSandeep Mewara23-Oct-12 4:13 

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.