有没有办法直接到一个网页,会使用C#和HTML等于什么 [英] Is there any way to direct to a page WHERE session is equal to something using C# and HTML

查看:68
本文介绍了有没有办法直接到一个网页,会使用C#和HTML等于什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提出一个分类目录,我试图做的,当你在TV链接preSS,它会是我给了电视类别会议,并直接向所有的产品TV。

下面是例子:

我有我的ACCESS数据库categoriesId类别的桌子和电视的id为:1。

下面是HTML code:

\r
\r

<一类=下拉菜单,切换数据切换=下拉菜单 HREF =#>类别<跨度类=插入符号>< / SPAN>< / A>\r
\r
                              < UL类=下拉菜单>\r
                                    <立GT;< A HREF =>&电视LT; / A>< /李>\r
                                    <立GT;< A HREF =#>笔记本电脑< / A>< /李>\r
                                    <立GT;< A HREF =#>冰箱和LT; / A>< /李>\r
                                    <立GT;< A HREF =#>作为厨房及LT; / A>< /李>\r
                                    <立GT;< A HREF =#>空调< / A>< /李>\r
                                    <立GT;< A HREF =#>洗衣机和烘干机< / A>< /李>\r
                                    <立GT;< A HREF =#>笔记本电脑< / A>< /李>\r
                                \r
                                < / UL>\r
                            \r
                            < /李>

\r

\r
\r

我想,当我preSS看电视,它会直接进入我的产品。

下面是我的C#code:

 会话[类别] = 1;
    的Response.Redirect(ShowProducts.aspx);

而在产品页面有这个code:

  INT idCat = int.Parse(会话[分类]的ToString());
            DT = ProductsService.GetProductsByCategory(idCat);
            GridView1.DataSourceID =;
            GridView1.DataSource = DT;
            GridView1.DataBind();

我不知道我应该以下拉菜单C#的HTML code之间的结合做的。

你能不能帮帮我吗?

非常感谢你。


解决方案

有一个与你的code没有问题,会议没有过期,所以你可以再次看到按钮,在登录,请关闭浏览器,然后再次打开它或者补考IIS / IIS防爆preSS再试

此外,如果你执行一个signout,请确保您删除用户ID会话

  Session.Remove(用户名)

I am making a Categories catalog , and I am trying to do when you press on the "TV" link , it will take the session that I gave to the "TV" category and direct to all of the products of "TV".

Here is the example :

I have on my ACCESS database a table of categories with "categoriesId" and TV's id is : 1

Here is the HTML code :

<a class="dropdown-toggle" data-toggle="dropdown" href="#">Categories <span class="caret"></span></a>

                              <ul class="dropdown-menu">
                                    <li><a href=>Televisions</a></li>
                                    <li><a href="#">Desktops</a></li>
                                    <li><a href="#">refrigerators</a></li>
                                    <li><a href="#">For Kitchen</a></li>
                                    <li><a href="#">air conditioners</a></li>
                                    <li><a href="#">Washing machines and dryers</a></li>
                                    <li><a href="#">Laptops</a></li>
                                
                                </ul>
                            
                            </li>

I want that When I press the "TV" , it will direct me into the Products.

Here is my C# code :

Session["category"] = 1;
    Response.Redirect("ShowProducts.aspx");

And in the Products page there is this code :

 int idCat = int.Parse(Session["Category"].ToString());


            dt = ProductsService.GetProductsByCategory(idCat);
            GridView1.DataSourceID = "";
            GridView1.DataSource = dt;
            GridView1.DataBind();

I dont know what I should do in order to combine between the HTML code of the dropdown menu to C#.

Can you please help me ?

Thank you very much.

解决方案

there is no problem with your code, the session is not expired so you can see the Sign in button again, close the browser and open it again, or resit the iis/iis Express and try again

also If you perform a signout, make sure that you remove the UserId session

Session.Remove("UserID")

这篇关于有没有办法直接到一个网页,会使用C#和HTML等于什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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