如何使用c#在浏览器中单击按钮来显示html内容 [英] how to display html content using button click in browser using c#

查看:83
本文介绍了如何使用c#在浏览器中单击按钮来显示html内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在该文件夹文件中有一个d文件夹,如下所示

RM.html





I有一个下拉列表(RM)当我从下拉列表中选择RM时,我想从文件夹d中显示RM.html文件。





为此我怎样才能在asp.net中使用c#来显示html使用c#。

i have one d folder in that folder file as follows
RM.html


I have one dropdownlist (RM) When i select the RM from the dropdownlist i want to display RM.html file from the folder d.


For that how can i do in asp.net using c# to display html using c#.

推荐答案

创建一个下拉列表并将项添加到列表中并将值设置为每个项目到您要获取的页面的网址



create a dropdownlist and add items to the list and set the value to each item to the url of the page you want to fetch

<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
    <asp:ListItem Value="http://www.something.com/page1.htm">Item1</asp:ListItem>
    <asp:ListItem Value="http://www.something.com/page2.htm">Item2</asp:ListItem>
</asp:DropDownList>





然后当下拉列表更改项目时,它会重定向到所需的URL





then when the dropdownlist changes item it redirects to the desired url

protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
    Response.Redirect(DropDownList1.SelectedValue);
}


这篇关于如何使用c#在浏览器中单击按钮来显示html内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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