怎么获取datalist 内控件的值
C# code
<asp:DataList ID="DataList1" runat="server">
<ItemTemplate>
<div class="keywords">
关键词:<%# KWSplit(Eval("QuestionClassification").ToString())%></div>
</div>
<div style="display: block;" class="questionn">
<p>
<textarea id="question_text" class="input-text" rows="4" cols="110">
<%# Eval("ReplyContent")%>
</textarea>
</p>
</div> </ItemTemplate>
</asp:DataList>>
怎么获取 <textarea id="question_text" class="input-text" rows="4" cols="110">
<%# Eval("ReplyContent")%>
</textarea>
的值
------解决方案--------------------
你需要写成
<textarea id="question_text" runat=server class="input-text" rows="4" cols="110">
<%# Eval("ReplyContent")%>
</textarea>
然后后台
//得到指定行的
HtmlTextArea q =
DataList1.Items[i].FindControl("question_text") as HtmlTextArea;
//得到全部的
protected void Button1_Click(object sender, EventArgs e)
{
foreach (DataListItem line in DataList1.Items)
{
HtmlTextArea q = line.FindControl("question_text") as HtmlTextArea;
Response.Write("<li>"+q.Value);
}
}