查询字符串中的Formview模式设置 [英] Formview Mode setting from Query String
本文介绍了查询字符串中的Formview模式设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在查询字符串中传递模式名称,然后尝试抓取它并在加载时设置表单视图模式。 它没有用,显然我做错了。 这是我的代码隐藏处理它。 问题
有什么问题?
公共字符串模式;
public string read =" ReadOnly" ;;
public string edit =" Edit";
public string insert =" Insert" ;;
protected void Page_Init(object sender,EventArgs e)
{
mode = Request.QueryString [" mode"]。ToString();
}
protected void FormView1_Init(Object sender,EventArgs e)
{
if(mode == read)
FormView1.ChangeMode(FormViewMode.ReadOnly);
else if(mode == edit)
FormView1.ChangeMode(FormViewMode.Edit);
else if(mode == insert)
FormView1.ChangeMode(FormViewMode.Insert);
}
解决方案
< blockquote>应该在ASP.NET论坛中询问ASP.NET相关问题:
http://forums.asp.net
I am passing a mode name in a Query String, and then trying to grab it and set the form view mode when it loads up. It isn't working, so obviously I'm doing something wrong. Here's my code-behind that deals with it. What is the problem
with it?
public string mode; public string read = "ReadOnly"; public string edit = "Edit"; public string insert = "Insert"; protected void Page_Init(object sender, EventArgs e) { mode = Request.QueryString["mode"].ToString(); } protected void FormView1_Init(Object sender, EventArgs e) { if (mode == read) FormView1.ChangeMode(FormViewMode.ReadOnly); else if (mode == edit) FormView1.ChangeMode(FormViewMode.Edit); else if (mode == insert) FormView1.ChangeMode(FormViewMode.Insert); }
解决方案
ASP.NET related questions should be asked in the ASP.NET forums: http://forums.asp.net
这篇关于查询字符串中的Formview模式设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文