button的postbackurl的问题

jaz_xie 2012-06-13 08:54:08
Button的postbackurl是把数据提交到另一个页面,
问题来了 :
在我点击button的时候怎么判断当前页面的一个文本框非空。

新手 不会用 见谅!
...全文
172 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
jaz_xie 2012-06-13
  • 打赏
  • 举报
回复
[Quote=引用 7 楼 的回复:]
引用 6 楼 的回复:
引用 5 楼 的回复:
void Page_Load (object sender, System.EventArgs e)
{
string text;

// Get the value of TextBox1 from the page that
// posted to this page.
text = ((TextBox)PreviousPage……
[/Quote]
没有明白我的意思。如果如果只是一个简单的非空验证我用JS就解决了 还用后台代码?
【Help】 2012-06-13
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]
引用 5 楼 的回复:
void Page_Load (object sender, System.EventArgs e)
{
string text;

// Get the value of TextBox1 from the page that
// posted to this page.
text = ((TextBox)PreviousPage.FindControl(……
[/Quote]这里取到了那边的控件的值了,具体怎么对这里操作随便你
jaz_xie 2012-06-13
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 的回复:]
void Page_Load (object sender, System.EventArgs e)
{
string text;

// Get the value of TextBox1 from the page that
// posted to this page.
text = ((TextBox)PreviousPage.FindControl("T……
[/Quote]

判断非空之后 不管是空不是空他还是提交到别的页面了把
【Help】 2012-06-13
  • 打赏
  • 举报
回复
void Page_Load (object sender, System.EventArgs e)
{
string text;

// Get the value of TextBox1 from the page that
// posted to this page.
text = ((TextBox)PreviousPage.FindControl("TextBox1")).Text;

// Check for an empty string.
if (text != "")
PostedLabel.Text = "The string posted from the previous page is "
+ text + ".";
else
PostedLabel.Text = "An empty string was posted from the previous page.";
}
jaz_xie 2012-06-13
  • 打赏
  • 举报
回复
都没有人知道?
我自己定下
jaz_xie 2012-06-13
  • 打赏
  • 举报
回复
我说的是在提交到别的页面之前在本页面做个判断! 我用return true 和return false 他提交到本页面
村长_乐 2012-06-13
  • 打赏
  • 举报
回复
js/jquery/验证控件
bdmh 2012-06-13
  • 打赏
  • 举报
回复
string.IsNullOrEmpty(TextBox1.Text) ??

62,268

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧