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

[Solved] RadGrid Row Data accessing in the Model Popup

1 Answer 203 Views
Grid
This is a migrated thread and some comments may be shown as answers.
DK
Top achievements
Rank 2
DK asked on 14 Jul 2009, 01:13 PM
hi
I am using radgrid and i have added a gridtemplate column in which i have link button.
on the link button i have added model popup extender which opens a popup in which i have a textbox and radgrid.
now on click of the link button there is no server trip.
so Can i get the specific row  column data to the popup window.
in the model popup window i have seach button which searches accorinding to to fields one is entered by user and other on is based on the row data in the grid.

please help me in this regard

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jul 2009, 07:53 AM
Hi DK,

Try with the following approach and see whether it helps to some extent.

ASPX:
 
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" AllowPaging="true" PageSize="5" OnNeedDataSource="RadGrid1_NeedDataSource" OnUpdateCommand="RadGrid1_UpdateCommand" OnItemDataBound="RadGrid1_ItemDataBound"
         <MasterTableView EditMode="InPlace" CellSpacing="-1">  
          
          <Columns> 
           <telerik:GridBoundColumn UniqueName="ProductName" HeaderText="ProductName" DataField="ProductName" ></telerik:GridBoundColumn> 
           <telerik:GridBoundColumn UniqueName="ProductID" HeaderText="ProductID" DataField="ProductID" ></telerik:GridBoundColumn> 
           <telerik:GridTemplateColumn UniqueName="TempCol"  HeaderText="TempCol"  > 
             <ItemTemplate> 
                 <asp:LinkButton ID="LinkButton1" runat="server">Show</asp:LinkButton> 
             </ItemTemplate> 
           </telerik:GridTemplateColumn> 
          
          </Columns> 
         </MasterTableView> 
        </telerik:RadGrid> 
 
         <div style="display: none"
             <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> 
         </div>  
         <cc1:ModalPopupExtender ID="ModalPopupExtender1" CancelControlID="LinkButton2" PopupControlID="Panel1" TargetControlID="Button1"  runat="server" > 
                 </cc1:ModalPopupExtender> 
          <div runat="server" id="dvEvent"  > 
                 <asp:Panel ID="Panel1" runat="server"  Width="400px"    > 
                     <asp:LinkButton ID="LinkButton2" runat="server">Cancel</asp:LinkButton> 
                     <uc1:WebUserControl ID="WebUserControl1" runat="server"  /> 
                      
                 </asp:Panel> 
            </div> 

CS:
 
  protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridDataItem) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            LinkButton lnkbtn = (LinkButton)item["TempCol"].FindControl("LinkButton1"); 
            lnkbtn.Attributes.Add("OnClick""shopModalPopup('" + item["ProductID"].Text + "');return false;"); 
        } 
    } 





JS:
 
<script type="text/javascript" language="javascript"
            function shopModalPopup(ID) 
            { 
                 var productID=ID; 
                 alert("Clicked RowID: " + productID) 
                //show the ModalPopupExtender 
                $find("<%=ModalPopupExtender1.ClientID %>").show();  
            } 
        </script> 


Thanks
Shinu
Tags
Grid
Asked by
DK
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Share this question
or