2011-03-01 4 views
0

도움이 필요하십니까? RadGrid Editform 모드의 RadComboBox에서 선택 항목을 처리하기 위해 RadClick에 RowClick 이벤트 처리기를 추가하고 싶습니다. 내가하고 싶은 것은 사용자가 콤보 박스에서 선택을하면 RadWindow를 표시하여 사용자가 추가 선택을 RadGrid Editform의 텍스트 상자에 표시 할 수있게하는 것입니다. 지금까지 내가 아무 것도 표시, 심지어RadGrid RadComboBox 클라이언트 팝업 도움말

function RowCreated(rowObject) { 
     alert("Row with Index: " + rowObject.Index + " was created"); 
    } 

    function RowSelected(sender, args) { 
     alert("row selected"); 
     inputFieldValue = args.getDataKeyValue("Type"); 
     alert(inputFieldValue); 
    } 

    function RowClick(rowIndex, e) { 
     alert("row Clicked"); 
     var sourceElement; 
     alert(rowIndex); 
    } 

alertboxes이 없다 무엇 그리드에 첨부 파일이 클라이언트 이벤트에서 발생

그것의 어떤 부분을보고

<telerik:RadGrid ID="securityGrid" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="false" Height="99.9%" AllowCustomPaging="true"> 
           <MasterTableView ShowFooter="true" AutoGenerateColumns="False" AllowSorting="true" AllowPaging="true" EnableViewState="true" ClientDataKeyNames="HKey" DataKeyNames="HKey"> 
            <NoRecordsTemplate> 
             <div align="center" style="font-weight: bold; font-size: 16px; color: Green; width: 100%;"> 
              There Are No Records To Display. Please Select Another View.</div> 
            </NoRecordsTemplate> 
            <Columns> 
             <telerik:GridBoundColumn UniqueName="EHKey" Visible="false" DataField="EHKey" /> 
             <telerik:GridCheckBoxColumn UniqueName="Active" HeaderText="Active" DataField="Active" 
              ColumnEditorID="ReportEditor"> 
              <ItemStyle Width="70" /> 
              <HeaderStyle Width="70" /> 
             </telerik:GridCheckBoxColumn> 
             <telerik:GridDropDownColumn UniqueName="UILocation" DataSourceID="UILocation_DS" 
              HeaderText="UI Location" DataField="UILocation" ListTextField="Description" ListValueField="PrimaryKey" 
              DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor"> 
              <ItemStyle Width="20%" Height="18" /> 
              <HeaderStyle Width="20%" /> 
             </telerik:GridDropDownColumn> 
             <telerik:GridDropDownColumn UniqueName="Type" DataSourceID="SecurityType_DS" HeaderText="Type" 
              DataField="SecurityType" ListTextField="Description" ListValueField="PrimaryKey" 
              DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor"> 
              <ItemStyle Width="120" Height="18" /> 
              <HeaderStyle Width="120" /> 
             </telerik:GridDropDownColumn> 
             <telerik:GridBoundColumn UniqueName="Item" HeaderText="Item" DataField="ItemList" 
              ColumnEditorID="ReportEditor"> 
              <ItemStyle Width="10%" /> 
              <HeaderStyle Width="10%" /> 
             </telerik:GridBoundColumn> 
             <telerik:GridDropDownColumn UniqueName="Access" DataSourceID="AccessType_DS" HeaderText="Access" 
              DataField="AccessType" ListTextField="Description" ListValueField="PrimaryKey" 
              DropDownControlType="RadComboBox" ColumnEditorID="ReportEditor"> 
              <ItemStyle Width="120" /> 
              <HeaderStyle Width="120" /> 
             </telerik:GridDropDownColumn> 
             <%-- <telerik:GridBoundColumn UniqueName="ItemList" Visible="false" DataField="ItemList" />--%> 
             <telerik:GridEditCommandColumn HeaderText="Edit" ButtonType="ImageButton" UniqueName="EditCommandColumn"> 
              <ItemStyle Width="40" CssClass="WATSImageButton" /> 
              <HeaderStyle Width="40" /> 
             </telerik:GridEditCommandColumn> 
             <telerik:GridButtonColumn UniqueName="DeleteCommandColumn" ButtonType="ImageButton" 
              CommandName="Delete" HeaderText="Del" ConfirmTitle="Delete Strategy Milestone!" 
              ConfirmText="Are you sure you want to delete this record?" ConfirmDialogType="RadWindow" 
              ConfirmDialogHeight="100" ConfirmDialogWidth="350"> 
              <ItemStyle Width="35" CssClass="WATSImageButton" /> 
              <HeaderStyle Width="35" /> 
             </telerik:GridButtonColumn> 
            </Columns> 
            <EditFormSettings> 
             <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="0" Width="100%" 
              CssClass="masterTable" /> 
             <FormTableStyle CellSpacing="0" CellPadding="0" Width="50%" /> 
             <FormStyle Width="100%" BackColor="#ffffe1"></FormStyle> 
             <EditColumn ButtonType="ImageButton" CancelText="Cancel" UpdateText="Update" InsertText="Add" /> 
            </EditFormSettings> 
           </MasterTableView> 
           <ClientSettings> 
            <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
             <ClientEvents OnRowClick="RowClick" OnGridCreated="GridCreated" /> 
            <Selecting AllowRowSelect="false" /> 
            <ClientEvents /> 
           </ClientSettings> 
          </telerik:RadGrid> 
+0

어떻게 RowClick 이벤트를 연결하고 있습니까? –

답변

0

디버그에게 JS 코드를 태그 처리 여부 및 오류 발생 여부 이것은 당신이 무엇이 잘못되었는지 추적하는 것을 도울 수 있습니다. 다음 줄에

+0

코드에 경고를 추가하여 디버깅하는 것은 예상대로 작동하지 않는 것처럼 보일 정도로 많이 발생하지 않았습니다. – Kobojunkie

0

봐 :

alert("Click on row instance: " + eventArgs.get_itemIndexHierarchical()); 

당신은있는 EventArgs를 정의하지 않았습니다. 이 함수의 첫 번째 줄이므로 행을 클릭 할 때 "아무 것도"발생하지 않습니다. 다음과 같이 함수가 될

변경 :

function RowClick(rowIndex, eventArgs) { 
      alert("Click on row instance: " + eventArgs.get_itemIndexHierarchical()); 
      var e = window.event; 
      var sourceElement; 
      alert(sourceElement); 
      if (e.srcElement) { 
       sourceElement = e.srcElement; 
       alert("sourceElement"); 
      } 
      else if (e.target) { 
      sourceElement = e.target; 
      alert("target"); 
      } 

     alert("About to check ROw Index"); 
     if (rowIndex != null) { 

      alert("Checked ROw Index"); 
      inputField = grid.MasterTableView.Rows[rowIndex].Control.getElementsByTagName("INPUT")[0]; 
      alert(inputField); 
      selvalue = sourceElement.value; 
      alert(selvalue); 
      if (inputField != null) { 
       alert("About to show it"); 
       var popuppage = "userroleselect.aspx" + "?sel=" + selvalue + "&avail=" + inputField.value; 
       alert("Shown it!"); 
       window.radopen(popuppage, "UserRoleDialog"); 
      } 
      else { 
       alert("Did Not Make it"); 
      } 
     } 
    } 

주목하라있는 EventArgs 매개 변수도 변수 e는 이제 기능에 정의되어 알 수 있습니다.

+0

죄송합니다. 내 부분에 오타가있었습니다. 내 경고 boixes 아무도 나타나지 않지만 문제가 줄을 것 같다 inputField = grid.MasterTableView.Rows [rowIndex] .Control.getElementsByTagName ("INPUT") [0]; – Kobojunkie

+0

첫 번째 문제는 알림 상자가 나타나야한다는 것입니다. 불필요한 코드를 주석으로 처리하고 알림 상자가 나타날 때까지 시작합니다. 일단 나타나면 한 번에 한 줄씩 코드를 추가 한 다음 문제의 정확한 위치가 결정될 때까지 각 줄을 추가 한 후에 테스트합니다. –

+0

코드를 모두 지웠고 여전히 팝업을 얻을 수 없었습니다 – Kobojunkie