新窗口打开gridview,页面间传递参数
我想实现以下场景。
我有许多下拉菜单,客户可以选择一系列标准。由此,他们将按下一个按钮,将生成查询,并且您会发现,将在由对象数据源绑定的新窗口中生成网格视图(或至少给人这样的印象)。我还希望用户能够多次修改搜索,以便他们可以生成许多新的窗口/网格视图。
那么现在......实现这一结果的最佳方法是什么?
我最初的想法是创建一个由客户端标准选择(在下拉列表中)生成的查询字符串,然后一个新页面将采用该查询字符串并在此处填充网格视图。我对这种方法的担忧是查询字符串可能会很大......创建一个长得可笑的查询字符串有什么缺点吗?
或者,人们是否还使用过任何其他方法或想法来产生类似的预期效果?
任何建议都被采纳,所有建议都受到热烈欢迎。
I have the following scenario I would like to implement.
I have a number of drop downs that the client can select a range of criteria. From this, they will press a button, the query will be generated and low and behold, a gridview will be produced in a new window (or at least give that impression) bound by an object datasource. I would also like the user to be able to amend the search numerous times so they can generate a number of new windows/gridviews.
Now then..what would be the best approach for achieving this result?
My initial thinking was to create a querystring generated by the client criteria selections (in the drop down lists), a new page would then take the querystring and populate the gridview here. My concern with this approach is that the query string could be a whopper...are there any disadvantages to creating a ridiculously long query string?
Alternatively, are there any other methods or ideas people have used to produce a similar desired effect?
Any suggests taken on board and all advice warmly received.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
长查询字符串并没有什么问题;它只是不像 Jeroen 的会话对象解决方案那样干净或易于使用。保存会话对象值:
Session("ObjectName") =variablename
检索它:
variablename = Session("ObjectName")
使用查询字符串的唯一原因是如果您不希望会话数据徘徊,尽管我不能想象一下为什么这会成为一个问题。
There is nothing wrong with a long querystring; it is just not as clean or as easy to use as Jeroen's session-object solution. Save the session object value:
Session("ObjectName") = variablename
Retrieve it:
variablename = Session("ObjectName")
The only reason to use a querystring is if you don't want the session data hanging around, though I can't imagine why that would be an issue.
您可以处理按钮的 Click 事件并将所需的变量存储在 Session 对象中。
在新打开的带有 gridview 的窗口中,您可以获取这些值并将它们分配给 ObjectDataSource 的 Selecting 事件中的正确参数。
You could handle the button's Click event and store the variables you need in Session object.
In the newly opened window with your gridview you take those values and assign them to the proper parameters in your ObjectDataSource's Selecting event.