没有得到asp dot net中datalist中textbot的值 [英] not get the value in textbot in datalist in asp dot net

查看:69
本文介绍了没有得到asp dot net中datalist中textbot的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在数据列表中有一个文本框但是我不能获得文本框代码的值:

I have a text box inside data list but I cant the get value of text box code is:

TextBox Comment = (TextBox)e.Item.FindControl("TextBox1");
string a = Comment.Text;



我在item_command上写这段代码,但每次都没有得到值

我得到空值


I write this code on item_command but I did't get the value
every time i get null value

推荐答案

如果你在Page_Load中绑定Datalist,请确保将datalist绑定在if(!this.IsPostBack){// Bind Datalist here} 。否则,每次事件都会刷新datalist,并且在任何控件内输入的数据都将丢失。
If you are binding Datalist in Page_Load, make sure to bind the Datalist inside if (!this.IsPostBack){//Bind Datalist here }. Otherwise datalist will be refreshed on every event and the data entered inside any control will be lost.


这篇关于没有得到asp dot net中datalist中textbot的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆