0
저는 ASP에서 새로운데 ascx 컨트롤에 갇혀 있습니다. 나는 다음과 같은 초기화 코드codebehind에서 javascript 동적 속성에 액세스하기
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Uploader.ascx.cs" Inherits="Uploader" %>
<script type="text/javascript" >
$(function()
{
var guid = GUID();//GUID() - js function which generates GUID
$('#' + '<%= OuterId %>').attr('guid', guid);
}
</script>
<div class="buttonNoHover" runat="server" id="current">Upload</div>
및 CS 초기화 코드 (의 일부)
protected void Page_Load(object sender, EventArgs e)
{
current.ID = this.ID;
}
내 컨트롤 선언은 다음과
<my:Uploader ID="upload" OuterId="upload" ClientIDMode="Static" runat="server" />
에서 모양과 제어를 Upload.ascx이 내 JS 나는 $ ('# upload'). attr ('guid') 속성에 액세스 할 수 있으며 올바른 값을 제공합니다. 그러나 양식을 제출할 때 upload.Attributes [ "guid"]는 코드 숨김에서 null이됩니다. 어떻게 액세스 할 수 있습니까? 그리고 내가 뭘 잘못하고 있습니까?
아, 감사 남자, 그것을 해결 내 문제가)) ID에 의해 숨겨진 컨트롤에 액세스 할 수있는 방법이 있나요, 아니면 내가 얻을 내 Request.Params을 확인해야 GUID 값? – Alex
@voo에 오신 것을 환영합니다. – Moons