.nET2.0小技巧


   
    <div class="postText">

<p class="MsoListParagraph" style="text-indent: 0cm; margin: 0cm 0cm 0pt 18pt;"><span style="">可以在</span><span lang="EN-US"><span style="font-family: Calibri;">page</span></span><span style="">指令上加上</span><span lang="EN-US"><span style="font-family: Calibri;">MaintainScrollPositionOnPostback</span></span><span style="">指令</span>

<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-family: Calibri;">2.</span><span style="font: 7pt 'Times New Roman';">? </span></span></span><span style="">在页面载入完之后,将焦点移动到某个控件,只需要指定</span><span lang="EN-US"><span style="font-family: Calibri;">Form</span></span><span style="">的</span><span lang="EN-US"><span style="font-family: Calibri;">DefaultFocus</span></span><span style="">属性就可以了。</span>

<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-family: Calibri;">3.</span><span style="font: 7pt 'Times New Roman';">? </span></span></span><span style="">通过</span><span lang="EN-US"><span style="font-family: Calibri;">DefaultButton</span></span><span style="">属性设置</span><span lang="EN-US"><span style="font-family: Calibri;">form</span></span><span style="">的默认相应按钮,即在用户敲回车时触发的按钮</span>

<p class="MsoListParagraph" style=""><span style="" lang="EN-US"><span style=""><span style="font-family: Calibri;">4.</span><span style="font: 7pt 'Times New Roman';">? </span></span></span><span style="">可以使用</span><span lang="EN-US"><span style="font-family: Calibri;">$</span></span><span style="">符号轻松的使用</span><span lang="EN-US"><span style="font-family: Calibri;">FindControl</span></span><span style="">方法找到控件</span>

<p class="MsoListParagraph" style="text-indent: 0cm; margin: 0cm 0cm 0pt 18pt;"><span style="">在上面的例子中使用</span><span lang="EN-US"><span style="font-family: Calibri;">form</span></span><span style="">的</span><span lang="EN-US"><span style="font-family: Calibri;">DefaultFocus</span></span><span style="">属性指定页面载入时焦点所在的控件,使用</span><span lang="EN-US"><span style="font-family: Calibri;">$</span></span><span style="">符号就可以轻松的定位</span><span lang="EN-US"><span style="font-family: Calibri;">txtName</span></span>

<p class="MsoListParagraph" style="text-indent: 0cm; margin: 0cm 0cm 0pt 18pt;"><span style="font-family: Calibri;"><span style="color: black;" lang="EN-US">TextBox?tb?</span><span style="color: blue;" lang="EN-US">=?this</span><span style="color: black;" lang="EN-US">.FindControl(</span><span style="color: gray;" lang="EN-US">"form1$formVw$txtName"</span><span style="color: black;" lang="EN-US">)?</span><span style="color: blue;" lang="EN-US">as?</span><span style="color: black;" lang="EN-US">TextBox</span></span><span style="font-family: Calibri;"><span style="color: blue;" lang="EN-US">;<br>if?</span><span style="color: black;" lang="EN-US">(tb?!</span><span style="color: blue;" lang="EN-US">=?null</span></span><span style="color: black;" lang="EN-US"><span style="font-family: Calibri;">)<br>{<br>????</span></span><span style="font-family: Calibri;"><span style="color: darkgreen;" lang="EN-US">//Access?TextBox?control<br></span><span style="color: black;" lang="EN-US">}</span></span>

<p class="MsoListParagraph" style=""><span lang="EN-US"> <span style="" lang="EN-US"><span lang="EN-US"></span></span></span>
<span style="" lang="EN-US"><span style=""><span style="font-family: Calibri;">6.</span><span style="font: 7pt 'Times New Roman';">? </span></span></span><span style="">我们可以使用验证控件的属性</span><span lang="EN-US"><span style="font-family: Calibri;"><span style="">????? </span>ValidationGroup </span></span><span style="">指定该验证控件所属组,同时在</span><span lang="EN-US"><span style="font-family: Calibri;">button</span></span><span style="">的</span><span lang="EN-US"><span style="font-family: Calibri;">ValidationGroup</span></span><span style="">属性中指定该</span><span lang="EN-US"><span style="font-family: Calibri;">button</span></span><span style="">所需要激活的验证组。</span>
?


<p class="MsoListParagraph" style="text-indent: 0cm; margin: 0cm 0cm 0pt 18pt;"><span style="color: blue;" lang="EN-US">><br><br></span>
</span></p>

 
 

你可能感兴趣的:(java,工作,.nET2.0小技巧)