Try our conversational search powered by Generative AI!

ItemCommand not firing

Vote:
 

Hi,

We are using Episerver cms 6 and developed a dynamic content in which we have a repeated control .This repeter control has a image button in it,when we click on this image button the even is not fired but the page refreshes. Please let us know how to fix this issue ?

#51821
Jun 23, 2011 15:25
Vote:
 
Quess you need to return your control With an ID
#51825
Jun 23, 2011 17:40
Vote:
 

Hi Anders Hattestad ,

Thanks for replaying quickly.Can you please provide us some sample code or a reference link, so that we know how to achive this?

#51832
Edited, Jun 24, 2011 5:07
Vote:
 

public override System.Web.UI.Control GetControl(EPiServer.PageBase hostPage)
{
 Control ctr=CreateYourControlHere();
 ctr.ID="ThisIsAStaticID_EPiServer_DontProvide_One";
 return ctr;
}

#51838
Jun 24, 2011 8:35
Vote:
 
Hi again, 

I have already added this in the class " DemoShow:IDynamicContent" as

public System.Web.UI.Control GetControl(EPiServer.PageBase hostPage)
{
var userControl = (UserControls.ViewClinic)hostPage.LoadControl("~/Templates/DynamicContent/aaa/view/ViewClinic.ascx");
return userControl;

}

Inside this usercontrol "ViewClinic.ascx", i have the repeater control and its child control(image button.). Still the item Command not firing..

And also this works fine in the development sever but not in the Production server.

Please get back asap....

 

#51839
Edited, Jun 24, 2011 10:31
Vote:
 
You don't set the ID in your code
#51841
Jun 24, 2011 11:13
Vote:
 

Hi ,

 

No luck .. i added the id as 

public System.Web.UI.Control GetControl(EPiServer.PageBase hostPage)
{
var userControl = (UserControls.ViewClinic)hostPage.LoadControl("~/Templates/DynamicContent/aaa/view/ViewClinic.ascx");
userControl.ID ="abc";

return userControl;

}

 still the same result ... event (ItemCommand) not getting fired.

#51842
Jun 24, 2011 11:21
Vote:
 
Try to set on cache on your test machine and don't be logged on. Does it work then there?
#51843
Jun 24, 2011 11:29
Vote:
 

Hi ,

I don't think its b'cos of cache... i added a button inside  repeater control and an event to that on click ="btnX_Click" like the one below.

protected void btnX_Click(object sender, EventArgs e)
{
                if (e.CommandName == "UpdateRow")
{
 
------------------------works  till here -------------- 
           foreach (RepeaterItem ri in rcUnitsRows.Items) --->breaks here
                    {
}

 "rcUnitsRows" which is my repeater control becomes "Null"..............

 


#51844
Jun 24, 2011 11:42
Vote:
 

You need to bind your items to the repeater each time.

#51847
Jun 24, 2011 16:02
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.