2014-10-13 2 views
0

jquery를 사용하여 일부 컨트롤을 숨기거나 표시하려고합니다. 그러나 파일 업로드 프로그램 제어를 제외하고는 다른 모든 컨트롤이 제대로 작동합니다. 파일 업로드 관리자 컨트롤을 숨기는 방법?jquery를 사용하여 FileUploader 컨트롤을 표시하거나 숨기는 방법?

내 소스 코드가

,

<tr> 
    <td align="left" class="style2"> 
     <asp:Label ID="lb12" runat="server" Text="CTC3"></asp:Label> 
    </td> 
    <td align="left"> 
     <asp:TextBox ID="txtctc2" runat="server" ClientIDMode="Static" TextMode="SingleLine"></asp:TextBox> 
    </td> 
</tr> 
<tr> 
    <td align="left" class="style2"> 
     <asp:Label ID="lb21" runat="server" Text="Certificate II"></asp:Label> 
    </td> 
    <td align="left"> 
     <asp:FileUpload ID="FileUpload3" ClientIDMode="Static" runat="server" /> 
    </td> 
</tr> 

내 JQuery와는,

$(window).load(function() { 
    $('#<%= txtctc3.ClientID %>').hide(); 
    $('#<%= FileUpload3.ClientID %>').hide(); 
}); 

텍스트 상자가 때 페이지 loade을 숨 깁니다하지만 가죽은 fileuploade를 제어. 제발 도와주세요

어떻게 파일 제어 아래에 숨기시겠습니까?

<input type="file" id="files" name="files[]" multiple /> 

답변

0

로 사용하면 모든 파일 업로드 컨트롤이 숨겨집니다.

$('input[id$="files"]').hide(); 
+0

Amit, 고마워요. –

+0

환영합니다 @DwaneMarsh – Amit

0

시도뿐만 아니라 파일 업로드 컨트롤에

ClientIDMode="Static" 

를 추가 할 수 있습니다.

+0

말킷 싱, 그래, 난 added.But 파일 컨트롤의 렌더링 ID를 복사 페이지 소스에서 다음 번 다음이 페이지를 실행하자 –

+0

작동하지 않음이있는해야 "FileUpload3"과 다른 무언가가 ct2100FileUpload3라고 말하십시오. 귀하의 jquery 코드를 $ ('# ct2100FileUpload3')로 수정하십시오. hide(); –

+0

Malkit Singh, 작동하지 않아서 죄송합니다. –

0

변경하면 코드에 :

$(window).load(function() { 
    $('<%= "#" + txtctc3.ClientID %>').hide(); 
    $('<%= "#" + FileUpload3.ClientID %>').hide(); 
}); 
+0

이것은 @ Mohamad shiralizadeh에서도 작동합니다. 감사합니다 –

+0

귀하의 환영 .. –

관련 문제