Wednesday, March 21, 2012

Composite Control with AsyncPostBack problem

Hello,

i have created a composite control ( imagebutton and linkbutton) with couple of properties etc... everything is working fine!

am using ajax also , but when i click on the imagebutton from that composite control an asyncpostback is called while if i click on linkbutton i get a normal postback ! weird!

anyone has an idea on this?

thank you its urgent

part of the composit control !

imagebtn =newImageButton();

imagebtn.ImageAlign =ImageAlign.AbsMiddle;

if (!isInabled)

{

imagebtn.Enabled =false;

}

imagebtn.CommandName ="Click";if (isDD.Equals("True"))

{

imagebtn.ID ="Anchor";

}

Controls.Add(imagebtn);

Controls.Add(newLiteralControl(" "));if (imagebtnAlign.Equals("top"))

{

Controls.Add(newLiteralControl("<br>"));

}

button =newLinkButton();

if (!isInabled)

{

button.Enabled =false;

}

button.CssClass = textCssName;

button.CommandName ="Click";

Controls.Add(button);


Hi,

Please try to force a postback with the following code:

button =newLinkButton();

if (!isInabled)

{

button.Enabled =false;

}

button.CssClass = textCssName;

button.CommandName ="Click";

button.Attributes.Add("onclick", "__doPostBack('" + button.ClientID + "','');");

Hope this helps.

No comments:

Post a Comment