API Questions on Kentico API.
Version 6.x > API > Can I Get Buuton Click Event Put On Transformation View modes: 
User avatar
Member
Member
patel_divyesh8252-yahoo.co - 8/7/2013 3:45:43 AM
   
Can I Get Buuton Click Event Put On Transformation
Hello

I am using Kentico 6.0 trial version

I am created Product Listing Page

In transformation I put one "HTML button" called button1 And I want Click Event of this button(Button1) how can i Do this???

===== Transformation Coding ====

<table style="float:left;margin:20px 20px 20px 20px;" align="center">
<tr>
<td height="120px" width="120px"><%# EcommerceFunctions.GetProductImage(Eval("SKUImagePath"), 200, Eval("SKUName", true))%></td>
</tr>
<tr>
<td><%# Eval("SKUName", true) %></td>
</tr>
<tr>
<td><%# GetSKUFormattedPrice(true, false) %></td>
</tr>
<tr>
<td><input type="Button1" Value="Add To Cart"></td>
</tr>
</table>

=======================

Please Reply me



User avatar
Kentico Support
Kentico Support
kentico_filipl - 8/7/2013 5:20:07 AM
   
RE:Can I Get Buuton Click Event Put On Transformation
Hello,

You can add a button click to your transformation using a standard asp.NET LinkButton control and script tag within your transformation.

LinkButton example:
<asp:LinkButton runat="server" text="Click here" id="LinkButton1" OnClick="MyMethod" />
<script runat="server">
// Call your function within this event handler.
void MyMethod(object sender, EventArgs e)
{
CustomFunctions.MyCustomFunction();
}
</script>

Best regards,
Filip Ligac

User avatar
Member
Member
patel_divyesh8252-yahoo.co - 8/8/2013 4:01:40 AM
   
RE:Can I Get Buuton Click Event Put On Transformation
Filip Ligac

Thank You So Much

User avatar
Member
Member
layek.suman-gmail - 2/11/2014 3:25:41 AM
   
RE:Can I Get Buuton Click Event Put On Transformation
Thanks for this post. But I was unable to do the same thing while using nested repeaters transformation.

Transformation Name:- OSN.PopularPackage.PopularPackages

<li>
<img src="<%# Eval("image")%>" alt="<%# Eval("Title") %>">
<h4><%# LimitLength(Eval("Title").ToString(), 25 , "...") %></h4>
<p><%# LimitLength(Eval("SubTitle").ToString(), 25 , "...") %></p>
<div class="price">
<cms:CMSRepeater ID="nestedPackages" runat="server" ClassNames="OSN.Package" Path="/%" WhereCondition='<%# "NodeID =" + Eval("LinkedPackageNodeID") %>' DelayedLoading="true" StopProcessing="true" TransformationName="osn.package.PackagePrice" ></cms:CMSRepeater>
</div>
<a class="subscribe" href="<%# Eval("ButtonLink")%>"><%# LimitLength(Eval("ButtonText").ToString(), 10 , "...") %></a>
</li>

<script runat="server">

protected void Page_PreRender(object sender, EventArgs e)
{
nestedPackages.StopProcessing = false;
nestedPackages.ReloadData(true);
}

</script>


Trnsformation Name:- osn.package.PackagePrice

<p>
<%# GetCurrencySymbol() %>
<br>
<span><%#Eval("SubscriptionType")%></span>
</p>
<span class="digits"><%# GetCountryPrice(Eval("SubscriptionCharge")) %></span>
<asp:LinkButton runat="server" text="Click here" id="LinkButton1" OnClick="MyMethod" />
<script runat="server">
// Call your function within this event handler.
void MyMethod(object sender, EventArgs e)
{
OSN.SetPackage();
}
</script>


Now the same is not working.

Please let us know how to write an event for a button which resides in nested transformation.

Regards,
Suman

User avatar
Kentico Consulting
Kentico Consulting
Kentico_RichardS - 2/11/2014 4:12:05 AM
   
RE:Can I Get Buuton Click Event Put On Transformation
Hi,

Just to let everyone else know. The scripts are getting resolved in both transformation and nested transformation correctly. There has to be something wrong with Sumans code. He sent an e-mail and we are trying to investigate it there.

Also please do not send multiple question as you will not make it faster for us to answer.

Kind regards,
Richard Sustek