GridView更新面板&链接按钮问题
好吧,我已经在互联网上搜索了解决方案,但还没有找到。
所以我在这里问...
我有一个填充的 gridview ,其中 3 列是链接按钮,其中 2 列重定向,其中一列下载文件。网格视图位于“更新”面板内。 当您单击该链接时,它看起来像是刷新了网站...网格视图消失了,什么也看不到,但所有其他元素都在那里。 所以问题是我如何制作一个链接按钮,它可以重定向到不同的页面,并且位于网格视图(位于更新面板内)内,可以工作。
Tnx 寻求答案。
Ok so i have searched all over the internet for a solution and i havent found one.
So ill ask here...
I have a populated gridview 3 of the columns are linkbuttons 2 of them redirect and one of them downloads a file. The gridview is inside the Update panel.
When u click the link it looks like it refreshes the website... the gridview is gone nothing to see but all the other elements are there.
So the question is how do i make a linkbutton that would redirect to a diffrent page and is inside a gridview, which is inside a updatepanel, work.
Tnx for the answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我首先会在网格中使用一个模板字段,其中包含 Gridview 中所需的链接按钮,并确保每个按钮都有唯一的 ID 和命令名。
然后,当链接按钮填充网格时,我会将网格的 rowdatabound 事件中的每行值分配给链接按钮。
然后,当有人单击其中一个链接按钮时,我将使用网格的 rowcommand 事件来执行链接按钮的代码。使用 switch 命令找出导致事件的命令名并在那里执行代码。
I would first of all use a template field in the grid which contains the linkbuttons you want in the Gridview and make sure each of them has an unique ID and commandname.
I would then assign values per row in the rowdatabound event of the grid to the linkbuttons as it populates the grid.
Then when someone click on one of the linkbuttons I would use the rowcommand event, of the grid, to execute the code for the link buttons. Use a switch command to find out which commandname caused the event and execute your code there.