This is a migrated thread and some comments may be shown as answers.

RadlightBox Command Event Not Firing

3 Answers 81 Views
LightBox
This is a migrated thread and some comments may be shown as answers.
Pitsco
Top achievements
Rank 2
Pitsco asked on 23 Dec 2013, 04:57 PM
This is my first time trying to use the RadLightbox and I understand that I am trying to use it more like a radwindow but would like to make the lightbox work if possible. I have a radlightbox as shown in the code below. My intention is to simply capture input from a radtextbox when the button is clicked, using the lightbox command event. The first issue is that I cannot get the command event of the lightbox to fire at all. Secondly, just to test I was trying to do some response.writes inside the command event of the lightbox, which did not work.

<telerik:RadLightBox ID="rlbSkus" ShowLoadingPanel="true" runat="server" Modal="true">
    <ClientSettings>
        <AnimationSettings HideAnimation="Resize" NextAnimation="Fade" PrevAnimation="Fade" ShowAnimation="Resize" />
    </ClientSettings>
    <Items>
        <telerik:RadLightBoxItem Width="380px">
            <ItemTemplate>
                <div style="width:360; text-align:center;margin:10px;">
                    <div style="padding:5px;text-align:center;">
                        <telerik:radtextbox id="rtbSkus" runat="server" TextMode="MultiLine" Width="310px" Height="300px" EmptyMessage="M2k Sku's, comma delimited"></telerik:radtextbox>
                    </div>
 
                    <div style="margin-top:20px;">
                        <telerik:RadButton ID="rbtnSubmitSkus" Text="Choose Product Skus" CommandName="btnSubmitSkus" CommandArgument='<% rtbSkus.text %>' runat="server"></telerik:RadButton>
                    </div>
                </div>
            </ItemTemplate>
        </telerik:RadLightBoxItem>
    </Items>
</telerik:RadLightBox
Protected Sub rlbSkus_Command(ByVal sender As Object, ByVal e As Telerik.Web.UI.LightBoxCommandEventArgs) Handles rlbSkus.Command
     Response.Write("command")
     If e.CommandName = "btnSubmitSkus" Then
         Response.Write(e.CommandArgument)
     End If
 End Sub

3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 25 Dec 2013, 04:21 PM
Hello Matt,

I'm afraid the Command event of the RadLightBox is not appropriate in this case since its Templates are different from these of the RadGrid, RadListView, etc. I suggest that you use the Click and Command events of the button itself and if necessary, access the LightBox using
 (sender as RadButton).NamingContainer .

I hope the clarification was helpful. Please feel free to turn to us if you happen to face any difficulties.

Regards,
Eyup
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Pitsco
Top achievements
Rank 2
answered on 02 Jan 2014, 03:10 PM
Can you explain further, with some code example, how to access the button when it is in the lightbox itemtemplate? I'm not sure I understand. Thanks.
0
Pitsco
Top achievements
Rank 2
answered on 02 Jan 2014, 04:33 PM
I got this to work, it now sees the command argument from inside the light box itemtemplate:

<telerik:RadButton ID="rbtnSubmitSkus" Text="Choose Product Skus" OnCommand="rbtnSubmitSkus_Command" CommandName="btnSubmitSkus" CommandArgument="test" runat="server"></telerik:RadButton>
Protected Sub rbtnSubmitSkus_Command(sender As Object, e As CommandEventArgs)
     Response.Write(e.CommandArgument)
 End Sub
Tags
LightBox
Asked by
Pitsco
Top achievements
Rank 2
Answers by
Eyup
Telerik team
Pitsco
Top achievements
Rank 2
Share this question
or