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

Linkbutton for radwindow to veiw detail

1 Answer 47 Views
Grid
This is a migrated thread and some comments may be shown as answers.
MIS-GSC
Top achievements
Rank 1
MIS-GSC asked on 27 Dec 2013, 09:59 AM
Dear Sir,
I had use the aps page to display header information by radgrid and there is linkbutton for the one for the field, when user click the the linkbutton, the detail page related to the number , the radwindow will be prompt . In side the radwindow there are such header information and radgird to show information. All controls are read only in the readwindow.
This is the .aspx for the GridtemplateColumn of the link button
  <telerik:GridTemplateColumn    HeaderText="Document No" UniqueName="grvDocument
      <ItemTemplate>
            <asp:LinkButton ID="LnkEACCAPV_DOCNO" runat="server" 
              CommandArgument=" <%#Container.ItemIndex%>"
              CommandName="ViewDocNo"   Text='<%# Bind("EACCAPV_DOCNO") %>'>
             </asp:LinkButton>
     </ItemTemplate>
     <HeaderStyle HorizontalAlign="Left" VerticalAlign="Middle" Width="135px" />
     <ItemStyle HorizontalAlign="Left" VerticalAlign="Top" Width="135px" />
</telerik:GridTemplateColumn>

This the above .aspx code-behind to show the radwindow :

Public Class EPAJournalDetail_Popup
    Inherits System.Web.UI.UserControlPrivate
Sub rgdEJL_Generation_ItemCommand(sender As Object, e As Telerik.Web.UI.GridCommandEventArgs)
                                                                                                                           Handles rgdEJL_Generation.ItemCommand
        If e.CommandName = "ViewJNLNo" Then
             Dim item As GridDataItem = DirectCast(e.Item, GridDataItem)
            Dim row As DataRowView = DirectCast(item.DataItem, DataRowView)
            Session("A") = item.GetDataKeyValue("A")
            Session("B") = item.GetDataKeyValue("B").ToString()
            Session("C") = item.GetDataKeyValue("C").ToString()
 
            Dim dt As DataTable = EEPA.GetJNL_HR(Session("A"), Session("B"), Session("C"))    ''<--Dtatatable for radwindow's  Header inforamtion
            If dt.Rows.Count > 0 Then
               '
                Dim dr As DataRow = dt.Rows(0)
                Session("D") = dr("D")
                Session("E") = dr("E")
                Session("F") = dr("F")
                Session("G") = dr("G")
                Session("H") = dr("H")
                Session("I") = dr("I")
                Session("J") = dr("J")
                Session("K") = dr("K")
                Session("L") = dr("L")
                
                Session("DT_DETAIL") = EEPA.GetJNL_DETAIL(Session("A"), Session("B"), Session("C"), Session("F"), "N") '<--For radindow's radgrid databind
 
            End If
                RadWindow_Popup.ShowDialog(A,B,C,D,E,F,G,H,I,J ,K,L)
                
            End If
        end
end sub
There is the function of RadWindow_Popup.

Public Class RadWindow_Popup
    Inherits System.Web.UI.UserControl
Public
Sub ShowDialog(A As String, B As String, C As String, D As String, E As String, _
                          F As String, G As String, H As String, I As String, _
                          J As String, K As String, L As String)
 
        Me.GetAjaxManager().ResponseScripts.Add("showDialog_" & Me.ClientID & "(""" & A & """,""" & _
                                                B & """,""" & C & """,""" & _
                                                D & """,""" & E & """,""" & _
                                                F & """,""" & G & """,""" & _
                                                H & """,""" & I  & """,""" & _
                                                J & """,""" & K & """,""" & L & """);")
        
        If IsNothing(lstJNL) = False Then
            lstJNL.Clear()                                                   'Public customer list
        End If
        lstJNL = GetData(DirectCast(Session("DT_DETAIL"), DataTable))  'Convert the Session to datatable
        rdgd.DataSource = lstJNL                                                                    'bind go the grid
end sub
 
    Public Sub rdgd_NeedDataSource(sender As Object,
                            e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles  rdgd.NeedDataSource
        TryCast(sender, RadGrid).DataSource = lstJNL
    End Sub

For the radwindow with the js to show on screen
<script type="text/javascript">      
       function showDialog_<%= ClientID %> (A, B, C, D, E, F, G, H, I, J,K, L) {
           document.getElementById('<%= lblA.ClientID %>').innerHTML =A;
           document.getElementById('<%= lblB.ClientID %>').innerHTML =B;
           document.getElementById('<%= lblC.ClientID %>').innerHTML =C;
           document.getElementById('<%= lblD.ClientID %>').innerHTML =D;
           document.getElementById('<%= lblE.ClientID %>').innerHTML =E;
           document.getElementById('<%= lblF.ClientID %>').innerHTML =F;
           document.getElementById('<%= lblG.ClientID %>').innerHTML =G;
           document.getElementById('<%= lblH.ClientID %>').innerHTML =H;
           document.getElementById('<%= lblI.ClientID %>').innerHTML =I;
           document.getElementById('<%= lblJ.ClientID %>').innerHTML =J;
           document.getElementById('<%= lblK.ClientID %>').innerHTML =K;
           document.getElementById('<%= lblL.ClientID %>').innerHTML =L;
 
            $find(" rdgd").get_masterTableView().rebind();   //Sometime got null reference error
           
           
           var wnd = $find("<%=  RadWindow_Popup.ClientID %>");
           wnd.show();
       }
Now, the problem is Label A - L can display the variables, radgrid cannot bind any data to the grid, it is ensured that the list and the datatable with record , please help 

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 02 Jan 2014, 03:27 PM
Hello Momoko,

I'm not sure that I fully understand what the problem actually is. Could you please provide some more detailed information about it? I noticed that there is a comment in the last script "Sometime got null reference error". In order to address this problem I would recommend that you insert some diagnostic code there:
...
var radGrid = $find("rdgd"),
    masterTable;
if (radGrid) {
    masterTable = radGrid.get_masterTableView();
    if (masterTable) {
        masterTable.rebind();
    }
    else {
        alert("masterTable is undefined");
    }
}
else {
    alert("radGrid is undefined");
}
...

This will help me determine what's causing the issue.

Regards,
Daniel
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.
Tags
Grid
Asked by
MIS-GSC
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Share this question
or