获取控件的值!!
<%for(inti=0;i<temp.Length-1;i++){stringshopsql="selectshopnamefromshopwhereid="+temp...
<% for (int i = 0; i < temp.Length - 1; i++)
{
string shopsql = "select shopname from shop where id=" + temp[i] + "";
string SName = (string)DBUtility.SqlHelper.ExecuteScalar(DBUtility.SqlHelper.SQLCON, System.Data.CommandType.Text, shopsql);
this.Num.Text = temp3[i].ToString();%>
<tr>
<td height="30" align="center" class="wenzi2"> <%Response.Write(SName); %></td>
<td align="center" class="wenzi2"><font color=red><%Response.Write(temp2[i]); %></font> 元</td>
<td width="52" align="center" class="wenzi2">
<asp:TextBox ID="Num" AutoPostBack="true" Width="20" onKeyUp="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" runat="server"></asp:TextBox>
</td>
<td width="53" align="center" class="wenzi2"><a href="#" onmouseover="geturl(<%Response.Write(id); %>,<%Response.Write(SName); %>)" class="txt1" id="Updateurl">修改</a></td>
<td width="69" align="center" class="wenzi2"><font color=red><%Response.Write(temp4[i]); %></font> 元</td>
<td width="53" align="center" class="wenzi2"><a href="goumai.aspx?action=del&delid=<%Response.Write(id); %>&shopname=<%Response.Write(SName); %>" class="txt1">删除</a></td>
</tr>
<%}%>
在点击修改后怎样获取TextBox里的值! 展开
{
string shopsql = "select shopname from shop where id=" + temp[i] + "";
string SName = (string)DBUtility.SqlHelper.ExecuteScalar(DBUtility.SqlHelper.SQLCON, System.Data.CommandType.Text, shopsql);
this.Num.Text = temp3[i].ToString();%>
<tr>
<td height="30" align="center" class="wenzi2"> <%Response.Write(SName); %></td>
<td align="center" class="wenzi2"><font color=red><%Response.Write(temp2[i]); %></font> 元</td>
<td width="52" align="center" class="wenzi2">
<asp:TextBox ID="Num" AutoPostBack="true" Width="20" onKeyUp="value=value.replace(/[^\d]/g,'') " onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))" runat="server"></asp:TextBox>
</td>
<td width="53" align="center" class="wenzi2"><a href="#" onmouseover="geturl(<%Response.Write(id); %>,<%Response.Write(SName); %>)" class="txt1" id="Updateurl">修改</a></td>
<td width="69" align="center" class="wenzi2"><font color=red><%Response.Write(temp4[i]); %></font> 元</td>
<td width="53" align="center" class="wenzi2"><a href="goumai.aspx?action=del&delid=<%Response.Write(id); %>&shopname=<%Response.Write(SName); %>" class="txt1">删除</a></td>
</tr>
<%}%>
在点击修改后怎样获取TextBox里的值! 展开
1个回答
展开全部
你用了循环,所以不能直接获取了。ASP.NET 不推荐使用这样的循环。
到了后台找都找不到。
推荐你用DataRepeater控件。
相当于一个循环。
后台也是循环取值:
foreach (RepeaterItem items in rptrMachine.Controls)
{
if (items.ItemType == ListItemType.Footer)
{
Label lblSystemCount = (Label)items.FindControl("lblSystemCount");
Label lblWarnCount = (Label)items.FindControl("lblWarnCount");
Label lblErrCount = (Label)items.FindControl("lblErrCount");
lblSystemCount.Text = cnt1.ToString();
lblWarnCount.Text = cnt2.ToString();
lblErrCount.Text = cnt3.ToString();
}
}
到了后台找都找不到。
推荐你用DataRepeater控件。
相当于一个循环。
后台也是循环取值:
foreach (RepeaterItem items in rptrMachine.Controls)
{
if (items.ItemType == ListItemType.Footer)
{
Label lblSystemCount = (Label)items.FindControl("lblSystemCount");
Label lblWarnCount = (Label)items.FindControl("lblWarnCount");
Label lblErrCount = (Label)items.FindControl("lblErrCount");
lblSystemCount.Text = cnt1.ToString();
lblWarnCount.Text = cnt2.ToString();
lblErrCount.Text = cnt3.ToString();
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询