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

Open a popup on a buttonColumn

23 Answers 366 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Adigard
Top achievements
Rank 1
Adigard asked on 10 Oct 2011, 12:57 PM
Greetings,

I've added a ButtonColumn on my RadGrid and i need to open a popup when i click on it.
Afterwards, I need to fill this popup in code Behind...

Can anyone say me how i can get acess to this button ?

23 Answers, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Oct 2011, 01:08 PM
Hello,

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" >
                   
                    <AjaxSettings>
                        <telerik:AjaxSetting AjaxControlID="RadGrid1">
                            <UpdatedControls>
                                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
 
                                <telerik:AjaxUpdatedControl ControlID="pnlview" />
                            </UpdatedControls>
                        </telerik:AjaxSetting>
                        
                     
                    </AjaxSettings>
                </telerik:RadAjaxManager>
                <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
 
.................
................
 
<telerik:GridButtonColumn CommandName="View" /> </telerik:GridButtonColumn>
................
................
 
  <asp:Panel ID="pnlview" runat="server">
                    <asp:LinkButton ID="lnkCopyDummy" runat="server"></asp:LinkButton>
                    <cc1:ModalPopupExtender ID="mpview" runat="server"
                        PopupControlID="pnlCopyContainer" TargetControlID="lnkCopyDummy"  />
                    <asp:Panel ID="pnlviewContainer" runat="server" Style="display: none;">
 </asp:Panel>
                </asp:Panel>
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
    {
        
            if (e.CommandName.ToString() == "View")
        {
             mpview.Show();
        }
}



Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 10 Oct 2011, 01:35 PM
Hello
And thank you again for your help!
What you wrote looks pretty good but it does not work :
Strange since the only thing i have added is :
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>


Do you know where could this problem come from ? When i click on the button, nothing happens
0
Jayesh Goyani
Top achievements
Rank 2
answered on 10 Oct 2011, 02:30 PM
hello,

please add below line of code in your page.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

please add "AjaxControlToolkit.dll" in your project's bin folder.

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 10 Oct 2011, 02:36 PM
I have already added AjaxControlToolkit in my references. The same about the line you posted .

therefore the problem comes from somewhere else unfortunately...


This is my aspx page:
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="tes1.aspx.cs" Inherits="WebApplication2.tes1" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
 
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <telerik:RadAjaxManager runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IntranetConnectionString %>"
        DeleteCommand="DELETE FROM rendezvous WHERE [idRDV] = @idRDV" InsertCommand="INSERT INTO rendezvous ([objet], [debut], [fin], [description], [lieu]) VALUES
(@objet, @debut, @fin, @description,@lieu)" SelectCommand="SELECT* from rendezvous" UpdateCommand="UPDATE rendezvous SET [objet] = @objet, [debut] = @debut,
[fin] = @fin,[description] = @description, [lieu] = @lieu WHERE [idRDV] = @idRDV">
        <DeleteParameters>
            <asp:Parameter Name="idRDV" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="objet" />
            <asp:Parameter Name="debut" />
            <asp:Parameter Name="fin" />
            <asp:Parameter Name="description" />
            <asp:Parameter Name="lieu" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="objet" />
            <asp:Parameter Name="debut" />
            <asp:Parameter Name="fin" />
            <asp:Parameter Name="description" />
            <asp:Parameter Name="lieu" />
            <asp:Parameter Name="idRDV" />
        </UpdateParameters>
    </asp:SqlDataSource>
    <telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True"
        AllowAutomaticUpdates="True" AllowFilteringByColumn="True" AllowPaging="True"
        AllowSorting="True" DataSourceID="SqlDataSource1" GridLines="None" ShowGroupPanel="True"
        Skin="Telerik" OnItemCreated="RadGrid1_ItemCreated"
        onitemcommand="RadGrid1_ItemCommand">
        <ClientSettings AllowDragToGroup="True">
            <Scrolling AllowScroll="True" UseStaticHeaders="True" />
        </ClientSettings>
        <MasterTableView AutoGenerateColumns="False" CommandItemDisplay="Top" DataKeyNames="idRDV"
            DataSourceID="SqlDataSource1" EditMode="InPlace">
            <RowIndicatorColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </RowIndicatorColumn>
            <ExpandCollapseColumn>
                <HeaderStyle Width="20px"></HeaderStyle>
            </ExpandCollapseColumn>
            <Columns>
                <telerik:GridBoundColumn DataField="objet" HeaderText="objet" SortExpression="objet"
                    UniqueName="objet">
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn DataField="debut" DataType="System.DateTime" HeaderText="debut"
                    SortExpression="debut" UniqueName="debut" PickerType="DateTimePicker" ColumnEditorID="debut">
                </telerik:GridDateTimeColumn>
                <telerik:GridBoundColumn DataField="description" HeaderText="description" SortExpression="description"
                    UniqueName="description">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="lieu" HeaderText="lieu" SortExpression="lieu"
                    UniqueName="lieu">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="idRDV" DataType="System.Int32" HeaderText="idRDV"
                    ReadOnly="True" SortExpression="idRDV" UniqueName="idRDV" Visible="False">
                </telerik:GridBoundColumn>
                <telerik:GridDateTimeColumn DataField="fin" DataType="System.DateTime" HeaderText="fin"
                    SortExpression="fin" UniqueName="fin" PickerType="DateTimePicker" ColumnEditorID="fin">
                </telerik:GridDateTimeColumn>
                <telerik:GridButtonColumn CommandName="Select" Text="Select" UniqueName="column1">
                </telerik:GridButtonColumn>
                <telerik:GridEditCommandColumn>
                </telerik:GridEditCommandColumn>
                <telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName="column2">
                </telerik:GridButtonColumn>
                <telerik:GridButtonColumn Text="Button" UniqueName="column" CommandName="View">
                </telerik:GridButtonColumn>
            </Columns>
            <EditFormSettings>
                <EditColumn UniqueName="EditCommandColumn1">
                </EditColumn>
            </EditFormSettings>
        </MasterTableView>
        <HeaderContextMenu EnableAutoScroll="True">
        </HeaderContextMenu>
    </telerik:RadGrid>
<%--    <telerik:GridDateTimeColumnEditor ID="debut" runat="server">
    </telerik:GridDateTimeColumnEditor>
    <telerik:GridDateTimeColumnEditor ID="fin" runat="server">
    </telerik:GridDateTimeColumnEditor>--%>
 
 
    <asp:Panel ID="pnlview" runat="server">
        <asp:LinkButton ID="lnkCopyDummy" runat="server"></asp:LinkButton>
        <cc1:modalpopupextender id="mpview" runat="server" popupcontrolid="pnlCopyContainer"
            targetcontrolid="lnkCopyDummy" />
        <asp:Panel ID="pnlviewContainer" runat="server" Style="display: none;">
        </asp:Panel>
    </asp:Panel>
 
 
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="pnlview" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" />
 
 
 
</asp:Content>

And my .cs page:


        protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)
        {
            if (e.CommandName.ToString() == "View")
            {
                mpview.Show();
            }
        }


Maybe you'll see something i don't !
thank you again for your help
0
Adigard
Top achievements
Rank 1
answered on 11 Oct 2011, 08:46 AM
Up
0
Adigard
Top achievements
Rank 1
answered on 11 Oct 2011, 04:34 PM
Nobody knows?
0
Jayesh Goyani
Top achievements
Rank 2
answered on 11 Oct 2011, 04:46 PM
Hello,

Please submit your project so we can try to solve your problem.

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 12 Oct 2011, 08:32 AM
Greetings,

My project : http://www.megaupload.com/?d=HCNN0VR3

The pages concerned by the problem are tes1.aspx+(.cs)

Thanks a lot for your help





0
Jayesh Goyani
Top achievements
Rank 2
answered on 13 Oct 2011, 06:23 AM
Hello,

currently i am working on your project.
i will update you shortly.


right now,there is not any error in your page.
your functionality is not working due to another reason. (its give JS error from webresource).

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 14 Oct 2011, 08:17 AM
Thanks a lot, let me know !
0
Jayesh Goyani
Top achievements
Rank 2
answered on 17 Oct 2011, 05:42 PM
Hello,.

There is an issue in your project.
please create new website and check it.

let me know if you have any concern.

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 18 Oct 2011, 01:57 PM
Very strange.
I'll try to create as you say a new project without the other fonctionnalities.
Just in order to open the popup.
i let you know.
Anyway thanks for your precious help!
0
Jayesh Goyani
Top achievements
Rank 2
answered on 18 Oct 2011, 04:28 PM
Hello,

ok good.
Let me know if any other issue.

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 21 Oct 2011, 11:13 AM
I've been trying to solve this problem for days ! im getting mad!

I also found a different topic in which you explained the same kind of problem :
http://www.telerik.com/community/forums/aspnet-ajax/grid/urgent-model-popup-not-working-with-radgrid-and-radajax-manager.aspx

I really don't understand
0
Adigard
Top achievements
Rank 1
answered on 21 Oct 2011, 04:44 PM
By the way, what is the purpose/utility of this button :

<asp:LinkButton ID="lnkCopyDummy" runat="server"></asp:LinkButton>
i don't understand ...
0
Jayesh Goyani
Top achievements
Rank 2
answered on 21 Oct 2011, 06:37 PM
Hello,

Please look in this.

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="LinkButton1"

If you want to open modal popup then then we have to set any TargetControlID. we have only one popup and so we can set only one TargetControlID. In our case we want to open the popup with multiple button (TargetControlID) so we can take Dummy Link Button for that.


Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 21 Oct 2011, 06:54 PM
Thank you, you still don't see what is wrong in my code ?
Im getting mad!
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Oct 2011, 05:50 AM
Hello,

ohhh..i really sorry.
I will again check your below project and inform you.
 
http://www.megaupload.com/?d=HCNN0VR3

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 22 Oct 2011, 08:40 AM
I noticed there is an error at the bottom of my brower ... " Javascript:_doPostBack...."
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Oct 2011, 09:37 AM
Hello,

Can you please provide more information about error or attach screenshot.

Thanks,
Jayesh Goyani
0
Adigard
Top achievements
Rank 1
answered on 22 Oct 2011, 09:47 AM
No actually i think this isn't an error, it just displays this when i let my mouse over the button ....

My mistake
0
Adigard
Top achievements
Rank 1
answered on 22 Oct 2011, 09:54 AM
Tonight , i also tried to create a new project with a basic RADGrid and less functionnalities.... just the code to get the popup and its not working neither ... this is insane !


Don't you have an exemple to send me ( a project with only this functionnality ) which works on your computer .
I could try yours to see what happens ...


thank you again for your time / help
0
Jayesh Goyani
Top achievements
Rank 2
answered on 22 Oct 2011, 09:55 AM
Hello,

Ok no problem.

Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Adigard
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Adigard
Top achievements
Rank 1
Share this question
or