asp.net 웹 양식이 있는데, 사용자가 값을 입력하는 텍스트 상자가있는 테이블을 포함하는 업데이트 패널이 있습니다. 텍스트 상자는 매우 오랫동안 실행중인 db 쿼리에서 생성되므로 테이블은 updatepanel에 있습니다. 폼이 타이머 컨트롤을 사용하여로드 된 후 몇 초 후에 생성됩니다. 양식 테이블을 다시 게시뒤에있는 코드에서 UpdatePanel의 값을 검색하려고 시도했습니다.
이여기에 ...
우리의 코드를 사용할 수없는 그 부분에 대한 코드입니다, 이것은 DynamicData 편집 페이지입니다.
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel2">
<ProgressTemplate>
<div>Getting subjects...</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" >
<ContentTemplate>
<asp:Timer ID="Timer1" runat="server" Interval="2000" Enabled="false" >
</asp:Timer>
<div id="subjects_fav">
<asp:Table ID="tabSubjectsFav" runat="server" BorderWidth="2" BorderColor="Aquamarine">
</asp:Table>
</div>
<asp:Button ID="UpdateButton" runat="server" OnClick="SaveEverything" Text="Save Everything" />
</ContentTemplate>
</asp:UpdatePanel>
Protected Sub Page_Init(ByVal sender As Object, ByVal e As EventArgs)
'DynamicDataManager1.RegisterControl(DetailsView1)
DynamicDataManager1.RegisterControl(lvArticles1)
DynamicDataManager1.RegisterControl(lvArticles2)
DynamicDataManager1.RegisterControl(lvArticles3)
DynamicDataManager1.RegisterControl(lvArticles4)
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
'trying to get the id_project for this page
'get article id for first article
If Not IsPostBack Then
Timer1.Enabled = True
Else
UpdatePanel2.Update()
End If
'now get related project from db
Dim db As New MTRData.mtddDataContext()
Dim art = (From a In db.articles _
Where a.id = Request.QueryString("id") Take 1 _
Select a).SingleOrDefault()
'txtid_project.Text = art.id_project
'need to use this all over the place so saving it as a property type thing as well
_ProjectID = art.id_project
_PublicationID = art.id_publication
_ArticleID = art.id
End Sub
Protected Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If boolTimerFired = False Then
Timer1.Enabled = False
boolTimerFired = True
GenerateSubjectsFavGrid(_ArticleID)
UpdatePanel2.Update()
End If
Timer1.Enabled = False
End Sub
안녕하세요, 감사합니다. OnInit에서 수행되지 않는 이유는 db에서 현재 값을 가져 오는 데 30 초가 걸리기 때문입니다 (묻지 마십시오!). 따라서 타이머를 통해 페이지가로드 된 후 2 초가 지나면 완료됩니다 ... – DaveEHS
"GenerateSubjectsFavGrid (_ArticleID)"가 텍스트 상자를 페이지에 동적으로 추가하는 곳이면 문제가 있습니다. 여기에 추가 된 컨트롤은 다음 포스트 백에서 생성 된 다음 페이지 객체에는 없을 것입니다. 그리드가 항상 같은 크기입니까? 그리드를 비 동적으로 만들고, 가시성을 false로 설정하고, 채워지는 즉시 보여줄 가능성이 있습니까? – womp
안녕하세요, 안타깝게도, 클라이언트마다 다를 것입니다. 값이 응답하지 않을 것인가? JavaScript를 통해 값을 변경하고 값을 채울 때 값을 세션이나 다른 것에 저장해야 할 것입니다. 실제로이 대화를 나누면 어떻게 든 필요한 컨트롤을 캐싱 할 수 있다고 생각하게되고 세션이나 다른 것으로 들어가는 값에 대해 걱정할 필요가 있습니다. advertedly 날 올바른 방향으로 가리키는 주셔서 감사합니다. 건배, 데이브. – DaveEHS