杀死/清除文本直到缓冲区结束的替代方法是什么?(What is the alternative to kill/clear text till the end of buffer?)
他们是C-Spc M-> del / backspace的替代品,用于杀死文本,可能只是删除而没有污染和膨胀杀死环,直到缓冲区结束?
问因为我没有找到上面说明的方法,相当优雅。
编辑:
wvxvw的建议很好,但我发现它不适用于极大的文件,因为Emacs不允许堆叠超过14个 Cu 。
Is their an alternative to C-SpcM->del/backspace for killing text, possibly just deleting without polluting and bloating the kill-ring, up till the end of the buffer?
Asking because I don't find the method, stated above, quite elegant.
Edit:
wvxvw's suggestion was a good one but I discovered that it won't work on extremely large files because Emacs doesn't allow stacking of more than fourteen C-u.
原文:https://stackoverflow.com/questions/17669287
最满意答案
这是因为当你点击按钮时,它不会直接进入
Button1_Click
事件,它会从顶部到底部,因此它首先加载Page_Load
然后它会进入事件,因此您应该放置一个支票if (IsPostBack && Session["MyVar"] != null) { varcheck(Session["MyVar"].ToString()); }
如果
Session["MyVar"]
不为null
因为它在第一次postback
时将为空,因此它不会抛出异常编辑1
如果不想使用会话,则可以使用静态变量来存储数据
public static string MyVar; protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(MyVar)) { varcheck(MyVar); } }
你可以点击设置值
protected void Button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(MyVar)) { MyVar= "Return this on postback"; varcheck(MyVar); } }
this is because when you click on button it does not go directly to
Button1_Click
Event it goes from top to bottom so it loads thePage_Load
first then it goes to the event so you should place a checkif (IsPostBack && Session["MyVar"] != null) { varcheck(Session["MyVar"].ToString()); }
that if
Session["MyVar"]
is notnull
because it will be null in firstpostback
to it will not throw exceptionEdit 1
if dont want to use session you can use static variable to store data
public static string MyVar; protected void Page_Load(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(MyVar)) { varcheck(MyVar); } }
and you can set value on click like
protected void Button1_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(MyVar)) { MyVar= "Return this on postback"; varcheck(MyVar); } }
相关问答
更多-
那么好吧..总是有助于将它从墙上反弹:-) 我们使用的是一个文本框自动完成扩展器,它引用了我们自己的自定义webmethod ,(在我们的应用程序中的自定义类中)。 似乎webmethod装饰迫使它无国界运营...因此没有会议。 我们将这个webmethod修饰函数移动到我们的页面代码隐藏页面中,现在它调用其他自定义类“with”会话对象可用性。 Alrighty then.. always helps to bounce it off a wall :-) We were using a textbox ...
-
Twitter Bootstrap Accordion - 回发后保持状态(Twitter Bootstrap Accordion - maintain state after postback)[2022-01-27]
简单的解决方案 - 在每个Accordion Panel中放置更新面板。 在桌面应用程序上花了这么多时间回到asp.net就像搬到另一个国家:-) Easy solution - put Update Panels in each Accordion Panel. Spent so much time on desktop apps coming back to asp.net is like moving to another country :-) -
所以问题是在新服务器上,页面的URL中有一个下划线。 做了一个解决方法,它就像一个魅力。 So the problem was that on the new server the URL to the page had an underscore in it. Made a workaround and it worked like a charm.
-
您可以在会话中存储任何内容,因此可以将其存储为string[]或List
: string[] selectedValues = this.LstRecipients.Items.Cast () .Where(i => i.Selected) .Select(i => i.Value) .ToArray(); Session["SelectedItemValues"] = selectedValues; /* on next postback yo ... -
这是因为当你点击按钮时,它不会直接进入Button1_Click事件,它会从顶部到底部,因此它首先加载Page_Load然后它会进入事件,因此您应该放置一个支票 if (IsPostBack && Session["MyVar"] != null) { varcheck(Session["MyVar"].ToString()); } 如果Session["MyVar"]不为null因为它在第一次postback时将为空,因此它不会抛出异常 ...
-
我想我发现为什么我的会话变成了空! 当我想在数据库中保存有关书籍的信息并将书籍的图像文件保存在应用程序文件夹中时,我没有权限保存文件,我的应用程序抛出错误,所有会话都变为空! I think I found out why my sessions become null ! when I want to save info about a book in db and save an image file of the book in an app folder , I don't have the per ...
-
我过去也遇到过同样的问题。 我所做的是给动态添加的控件一个ID ,并确保它在回发时保留该ID(在我的情况下,我将所有信息保留在会话中,并重新创建控件)。 一旦回发控件具有与以前相同的ID,Microsoft就会执行魔术并使用回发前值重新填充控件。 I've had the same problem in the past. What I did was give the dynamically-added control an ID, and made sure it retained that ID al ...
-
您需要覆盖Fragment类中的onActivityResult方法并将其传递给会话以完成会话转换。 无论您是否使用UiLifecycleHelper,都需要这样做。 You need to override the onActivityResult method in your Fragment class and pass it on to the session in order to complete the session transitions. This needs to happen reg ...
-
通过回发保持对象(Persisting an object through postback)[2021-10-31]
感谢Andrew-Barber的建议,我曾希望他出现并回答这个问题(你还可以!),我想出了解决方案: 在OnInit方法中创建对象并删除if(!Page.IsPostBack)块,而不是为页面的每个实例实例化对象。 这在页面的生命周期的早期发生,并在服务器端将对象保留在内存中,允许更改客户端进行注册。 Thanks to the advise of Andrew-Barber, who I had hoped would show up and answer this question (you still ... -
在这些页面/事件中使用try catch。 try { //Do stuffs here such as pageload, click events and so on... } catch(Exception ex) { Session["ErrorMsg"] = ex.Message; Response.Redirect("~/Error.aspx"); } 在Error.aspx中 protected void Page_Lo ...