السلام عليكم
أنا مبتدئ في عالم Asp.net و لقد قرأت عنه الكثير .... و قد أكدت معظم المواقع أن ViewState مختصة بحفظ القيمة المدخلة أثناء عملية ال PostBack
حاولت الكثير و لكن القيمة بعد عمليتين أو ثلاث PostBack تنمسح
أنا وضعت في ال PageDirective EvableViewState
ووضعت في كل Control يحوي ال TextBox مثل Panel , Table كلهم EnableViewState = true
هل يجب علي أن أضع جميع القيم الموجودة في الصفحة في متغيرات يدوياً على ViewState خاصة أنا أنشؤها ... هل من المعقول أن يكون هذا هو الحل ؟
هذا هو كود Html الخاص بالصفحة ... فقط ال panel المطلوب ... و أنا متأكد تماما من وضع EnableViewState في بداية الصفحة ... المطلوب هو حفظ قيمة ال State في TxtEvaluationReason
بالمناسبة : جربت Bind , Eval ما نفعوا
<asp:Panel ID="PnlDirectManager" runat="server" Height="488px" Width="786px"
style="margin-right: 2px" EnableViewState ="true">
<table style="width: 81%; height: 458px; overflow: visible;" enableviewstate="true">
<tr>
<td dir="rtl" align="right" colspan="3" style="height: 320px">
<asp:GridView ID="GridViewGrades" runat="server" AutoGenerateColumns="False"
CellPadding="4" DataSourceID="AccessDataSourceGrades" ForeColor="#333333"
ShowFooter="True" Width="727px">
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<Columns>
<asp:BoundField DataField="QuestionID" HeaderText="م"
SortExpression="QuestionID">
<ItemStyle CssClass="Ar_TableCell" Width="10px" />
</asp:BoundField>
<asp:BoundField DataField="QuestionDesc"
FooterText="الـــتــــقـــديـــــر الــعــــــام"
HeaderText="الـــتــــقـــديـــــر" SortExpression="QuestionDesc">
<ItemStyle CssClass="Ar_TableCellRight" HorizontalAlign="Right" />
</asp:BoundField>
<%--<asp:BoundField DataField="Degree" HeaderText="الـــدرجـــــة"
SortExpression="Degree">
<ItemStyle CssClass="Ar_TableCell" HorizontalAlign="Center" Width="20px" />
</asp:BoundField>--%>
<asp:TemplateField HeaderText="الــــدرجـــة">
<ItemTemplate>
<asp:DropDownList ID="CboDegree" runat="server" Height="20px" onchange = "CalculateTotalGrade();"
SelectedValue='<%# Bind("Degree") %>' Width="80px" enableviewstate="true">
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
<asp:ListItem>5</asp:ListItem>
<asp:ListItem>6</asp:ListItem>
<asp:ListItem>7</asp:ListItem>
<asp:ListItem>8</asp:ListItem>
<asp:ListItem>9</asp:ListItem>
<asp:ListItem>10</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
<ItemStyle Width="80px" />
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White"
Height="50px" HorizontalAlign="Center" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</td>
</tr>
<tr>
<td class="TDTextBoxCaptionRight" dir="rtl" colspan="2">
</td>
</tr>
<tr>
<td class="TDTextBoxCaptionRight" dir="rtl" colspan="2">
تـــفــــصــيــل أســـبـــاب نــتـــيــجــة التـــقـــريــــر :</td>
</tr>
<tr>
<td align="center" dir="rtl" colspan="2">
<table style="width: 100%">
<tr enableviewstate="true">
<td class="style1" style="width: 640px" enableviewstate="true">
<asp:TextBox ID="TxtEvaluationReason" runat="server" Height="60px" Width="606px"
CssClass="TDRightLarge" EnableViewState="true" ></asp:TextBox>
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="TDTextBoxCaption" style="width: 1087px; height: 37px;">
<asp:Button ID="BtnSaveDirectManager" runat="server" CssClass="EvButton"
Text="حــــــفــــــظ" />
</td>
<td class="TDTextBoxCaption" style="width: 625px; height: 37px;">
<asp:Label ID="LblDirectManagerName" runat="server"></asp:Label>
</td>
<td align="right" style="height: 37px">
<asp:Button ID="BtnApproveDirectManager" runat="server"
CssClass="EvButton" Height="25px" Text="إعــــتــــمــــد" Width="143px" />
</td>
</tr>
</table>
</asp:Panel>
