日期:2014-05-18  浏览次数:20686 次

请教个关于__doPostBack()的问题
我想通过__doPostBack来cs页里面传text的值,应该怎么样去写这个函数?谢谢大家了。
<form   runat= "server "   id= "form1 "   name= "form1 ">
<table   class= "toolbar "   cellSpacing= "0 "   width= "98% "   align= "center "   border= "0 "> <tr>
<td   class= "catelink "   style= "height:   26px ">
        <table   border= "0 "   cellpadding= "0 "   cellspacing= "0 ">
        <tr> <TD   class= "toolbarT "   style= "height:   18px "> </TD>
        <td   class= "toolbarT "   onmouseover= "MO() "   onmouseout= "MU() "   noWrap   style= "width:   47px;   height:   18px ">
<SPAN   class= "saveButton "> &nbsp;&nbsp;&nbsp;&nbsp; </SPAN>
        <a   id= "lkbtn "   class= "text "   href= "javascript:__doPostBack( 'lkbtn ', ' ') "> 保存 </a> </td>
        </tr>
      </table>
<asp:LinkButton   ID= "LinkButton1 "   runat= "server "   Visible= "false "> LinkButton </asp:LinkButton>
</td>
</tr>
</table>
<TABLE   cellSpacing= "1 "   cellPadding= "4 "   width= "98% "   align= "center "   border= "0 ">
<TBODY> <TR>
<TD   width= "80 "   style= "height:   36px "> 模块分类名称 <font   color= "#ff0000 "> * </font> </TD>
<TD   style= "height:   36px "> <input   name= "txtName "   type= "text "   id= "txtName "   /> <input   name= "TypeID "   type= "hidden "   id= "TypeID "   />
<span   id= "Label1 "   style= "color:Red; "> </span> </TD>
</TR>
<TR>
<TD   vAlign= "top "> 分类说明 </TD>
<TD> <textarea   name= "txtNote "   rows= "2 "   cols= "20 "   id= "txtNote "   style= "height:48px;width:304px; "> </textarea> </TD>
</TR>
</TBODY>
</TABLE>
</form>

也就是说如何获得点击 <a   id= "lkbtn "   class= "text "   href= "javascript:__doPostBack( 'lkbtn ', ' ') "> 保存 </a> 后在cs页面里面得到txtName、TypeID、txtNote的值?谢谢大家了

------解决方案--------------------
<td class= "toolbarT " onmouseover= "MO() " onmouseout= "MU() " noWrap style= "width: 47px; height: 18px ">
<SPAN class= "saveButton "> &nbsp;&nbsp;&nbsp;&nbsp; </SPAN>
<asp:LinkButton ID= "lkbtn " runat= "server " OnClick= "lkbtn_Click "> 保存 </asp:LinkButton> </td>


在page_load中写:
this.lkbtn.Attributes[ "class "] = "text ";


然后在事件处理方法lkbtn_Click中实现你的后台处理逻辑。
------解决方案--------------------
<asp