母版页上的处理按钮单击事件 [英] handling button click event on master page

查看:105
本文介绍了母版页上的处理按钮单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我的母版页上的搜索框和按钮。当一个搜索词,用户类型和命中提交,我想在搜索结果中的内容页面中显示。

I have a search field and button on my master page. When a user types in a search term, and hits submit, I would like the search results to display in a content page.

什么是处理这个是最好的,最合理的方式?

What would be the best, most logical way of handling this?

我想用我的内容页面上的FindControl找到按钮,然后莫名其妙地弄清楚,如果已经被点击或不...但我的逻辑迅速升级,下坡。

I thought of using FindControl on my content page to find the button, and then somehow figure out if it had been clicked or not...but my logic quickly spiraled downhill.

有什么想法?

谢谢!

推荐答案

我处理这一个非常简单的方法:

I handle this in a really simple way:

当按钮被点击我只是设置我想寻找到一个会话变量,然后将页面重定向到我的搜索页面,这需要该值的信息

When the button is clicked I simply set the information I want to search for into a session variable and then redirect the page to my search page, which takes that value

         protected void btnSearch_OnClick(object sender, EventArgs e)
    {
            Session["General"] = txtSearch.Text;
            Response.Redirect("\\Search.aspx");
    }

这篇关于母版页上的处理按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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