RadlightBox Command Event Not Firing

4 posts, 0 answers
  1. Pitsco
    Pitsco avatar
    3 posts
    Member since:
    Jun 2007

    Posted 23 Dec 2013 Link to this post

    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
  2. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 25 Dec 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Pitsco
    Pitsco avatar
    3 posts
    Member since:
    Jun 2007

    Posted 02 Jan 2014 Link to this post

    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.
  5. Pitsco
    Pitsco avatar
    3 posts
    Member since:
    Jun 2007

    Posted 02 Jan 2014 Link to this post

    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
Back to Top