Hi this is jewel jose from India.
I am using telerik rad grid for my web application development. Now i am trying to interchange selected data row with two grids using javascript support of the telerik rad grid. Following is the code snippet but i am experiencing some issues, i was able to set datasource for the 2nd grid with data of selected row from the firs grid and bind it also. But the grid is not showing up the data. I am not sure why it is happening so. showMessage is the javascript code that i am using for this.. If any one could please help me to get rid of this issue it will be a great help for me.
I am using telerik rad grid for my web application development. Now i am trying to interchange selected data row with two grids using javascript support of the telerik rad grid. Following is the code snippet but i am experiencing some issues, i was able to set datasource for the 2nd grid with data of selected row from the firs grid and bind it also. But the grid is not showing up the data. I am not sure why it is happening so. showMessage is the javascript code that i am using for this.. If any one could please help me to get rid of this issue it will be a great help for me.
| <%@ Page Language="VB" MasterPageFile="~/Masters/MFISoftMaster.master" AutoEventWireup="false" CodeFile="AreaOfOperation.aspx.vb" Inherits="Pages_AreaOfOperation" title="Untitled Page" %> |
| <asp:Content ID="Content1" ContentPlaceHolderID="CPHMain" Runat="Server"> |
| <script language="javascript" type="text/javascript"> |
| var obj= new Object(); |
| function ShowMessage(sender, args) |
| { |
| var id = args.getDataKeyValue("Addressid"); |
| var tableView = $find("<%= Grid1.ClientID %>").get_masterTableView(); |
| //Get the clicked row |
| var index_id = 0; |
| var index = args.get_itemIndexHierarchical(); |
| var item = args.get_tableView().get_dataItems()[index]; |
| var rowElement = item.get_element(); |
| obj.Addressid = id; |
| obj.name = rowElement.innerText; |
| var tableView_temp = $find("<%= RadGrid2.ClientID %>"); |
| tableView_temp._updating = true; |
| var tableView1 = $find("<%= RadGrid2.ClientID %>").get_masterTableView(); |
| var data_items = tableView1._dataItems; |
| tableView1.set_dataSource(obj); |
| tableView1.dataBind(); |
| data_items = tableView1._dataItems; |
| } |
| </script> |
| <div style="text-align: center; vertical-align: middle; position: absolute; top: 130px; |
| left: 100px;"> |
| <MFI:PentaPanel ID="pnlContainer" Title="Area Of Operation" runat="Server" RenderNormally="False" |
| CommandPanelId="PnlCommand" Height="340px" Width="850px" ShowPrintIcon="true" |
| PrintIconUrl="~\Includes\Images\print1.ico"> |
| <div style="width: 770px; height: 330px"> |
| <table> |
| <tr align="left"> |
| <td align="left"> |
| <telerik:RadGrid ID="Grid1" runat="server" AutoGenerateColumns="false" |
| GridLines="None" ClientSettings-AllowExpandCollapse="true" |
| ClientSettings-AllowKeyboardNavigation="true" |
| AutoGenerateDeleteColumn="false" PageSize="15" AutoGenerateEditColumn="false" |
| Width="300px" Skin="Outlook" Height="300px" EnableViewState="True"> |
| <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="true"> |
| <ClientEvents OnRowSelected="ShowMessage" /> |
| </ClientSettings> |
| <MasterTableView DataKeyNames="Addressid" ClientDataKeyNames="Addressid"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Addressid" ItemStyle-Width="0PX" Visible="false" UniqueName="Addressid"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="name" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" HeaderText="Name" UniqueName="name"></telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </td> |
| <td> |
| <telerik:RadGrid ID="RadGrid2" runat="server" AutoGenerateColumns="false" |
| GridLines="None" |
| ClientSettings-AllowKeyboardNavigation="true" |
| AutoGenerateDeleteColumn="false" PageSize="15" AutoGenerateEditColumn="false" |
| Width="300px" Skin="Outlook" Height="300px" EnableViewState="True" |
| ShowFooter="True" AllowSorting="true" |
| AllowAutomaticDeletes = "False" AllowAutomaticUpdates ="False" |
| AllowAutomaticInserts="False" > |
| <ClientSettings Selecting-AllowRowSelect="true" EnableRowHoverStyle="true"> |
| <%--<ClientEvents OnRowSelected="ShowMessage" />--%> |
| </ClientSettings> |
| <MasterTableView DataKeyNames="branch_oper_districtid" ClientDataKeyNames="branch_oper_districtid"> |
| <RowIndicatorColumn> |
| <HeaderStyle Width="20px" /> |
| </RowIndicatorColumn> |
| <ExpandCollapseColumn> |
| <HeaderStyle Width="20px" /> |
| </ExpandCollapseColumn> |
| <Columns> |
| <telerik:GridBoundColumn DataField="Addressid" ItemStyle-Width="0PX" Visible="false" UniqueName="Addressid"></telerik:GridBoundColumn> |
| <telerik:GridBoundColumn DataField="name" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" HeaderText="Name" UniqueName="name"></telerik:GridBoundColumn> |
| </Columns> |
| </MasterTableView> |
| </telerik:RadGrid> |
| </td> |
| </tr> |
| </table> |
| </div> |
| </MFI:PentaPanel> |
| </div> |
| </asp:Content> |