Jquery Ui标签加载到asp.net中的页面

时间:2022-04-06 05:37:43

I am using a jquery Ui tabs in my application

我在我的应用程序中使用了jquery Ui选项卡

In this i am loading three different tabs which has a asp form on each tab. We know that asp page must have only one form so i loaded those contents from two other pages like below.

在这里我加载三个不同的选项卡,每个选项卡上都有一个asp形式。我们知道asp页面必须只有一个表单,所以我从其他两个页面加载这些内容,如下所示。

<li><a href="#tabs-1">Home</a></li>
<li><a href="user_info.aspx">My Uploads</a></li>
<li><a href="Enquiry.aspx">Enquiry</a></li>

In user_info.aspx page i am having a GridView

在user_info.aspx页面中,我有一个GridView

 <form runat="server">
   <asp:GridView ID="GridView1" runat="server" OnRowDataBound="GridView1_RowDataBound" ></asp:GridView>     
 </form>

I have added a pagenation in my grid view which on changing page loads that user_info.aspx page. Is there a way to load this inside the after when i am changing the pagenation pages of grid view.

我在网格视图中添加了一个pagenation,在更改页面时加载了user_info.aspx页面。当我更改网格视图的pagenation页面时,有没有办法在后面加载它。

1 个解决方案

#1


1  

Edit: After much researching I came to the conclusion that this cannot be done the way you are trying to do it. The reason why is because when you load the user_info.aspx page into Default.aspx you are having 2 forms with id form1 in your page. Therefore, when the __doPostBack() function is called by clicking in the GridViews pages, you will get a Javascript exception because the __doPostBack() being called is the one from Default.aspx. Since you are passing arguments from user_info.aspx (GridView1), you get the error. If you change one of the ids of the forms in your pages, and click in the GridView's page, you will get an asp.net exception, because the ViewState is going to be invalid (in case you also change the action of the form, to Default.aspx).

编辑:经过大量研究后,我得出结论,这不可能按照你想要的方式完成。原因是因为当您将user_info.aspx页面加载到Default.aspx时,您的页面中有两个带有id form1的表单。因此,当通过单击GridViews页面调用__doPostBack()函数时,您将获得Javascript异常,因为被调用的__doPostBack()是来自Default.aspx的那个。由于您从user_info.aspx(GridView1)传递参数,因此会出现错误。如果你更改页面中某个表单的ID,然后单击GridView的页面,你将得到一个asp.net异常,因为ViewState将无效(如果你也改变了表单的动作,到Default.aspx)。

Not everything is bad news, you have some solutions:

不是一切都是坏消息,你有一些解决方案:

Solution 1: Simply add the GridView to your tab.

解决方案1:只需将GridView添加到选项卡即可。

Solution 2: Add an IFrame pointing to user_info.aspx. If you REALLY have to have the GridView in a different page, I would go with this solution.

解决方案2:添加指向user_info.aspx的IFrame。如果你真的必须在不同的页面中使用GridView,我会选择这个解决方案。

Example:

例:

Markup:

标记:

<div id="tabs-2">
    <iframe src="user_info.aspx" id="myFrame" frameborder="0"></iframe>
</div>

jQuery:

jQuery的:

$('#myFrame').load(function () {
    $(this).height($(this).contents().height());
    $(this).width($(this).contents().width());
});

This jQuery makes the IFrame fit it's content. It really does look like it belongs there (it's also borderless), and if you change the page, it stays in the same tab.

这个jQuery使IFrame符合它的内容。它确实看起来像它属于那里(它也是无边界的),如果你更改页面,它将保持在同一个选项卡中。

Screenshot:

截图:

Jquery Ui标签加载到asp.net中的页面

#1


1  

Edit: After much researching I came to the conclusion that this cannot be done the way you are trying to do it. The reason why is because when you load the user_info.aspx page into Default.aspx you are having 2 forms with id form1 in your page. Therefore, when the __doPostBack() function is called by clicking in the GridViews pages, you will get a Javascript exception because the __doPostBack() being called is the one from Default.aspx. Since you are passing arguments from user_info.aspx (GridView1), you get the error. If you change one of the ids of the forms in your pages, and click in the GridView's page, you will get an asp.net exception, because the ViewState is going to be invalid (in case you also change the action of the form, to Default.aspx).

编辑:经过大量研究后,我得出结论,这不可能按照你想要的方式完成。原因是因为当您将user_info.aspx页面加载到Default.aspx时,您的页面中有两个带有id form1的表单。因此,当通过单击GridViews页面调用__doPostBack()函数时,您将获得Javascript异常,因为被调用的__doPostBack()是来自Default.aspx的那个。由于您从user_info.aspx(GridView1)传递参数,因此会出现错误。如果你更改页面中某个表单的ID,然后单击GridView的页面,你将得到一个asp.net异常,因为ViewState将无效(如果你也改变了表单的动作,到Default.aspx)。

Not everything is bad news, you have some solutions:

不是一切都是坏消息,你有一些解决方案:

Solution 1: Simply add the GridView to your tab.

解决方案1:只需将GridView添加到选项卡即可。

Solution 2: Add an IFrame pointing to user_info.aspx. If you REALLY have to have the GridView in a different page, I would go with this solution.

解决方案2:添加指向user_info.aspx的IFrame。如果你真的必须在不同的页面中使用GridView,我会选择这个解决方案。

Example:

例:

Markup:

标记:

<div id="tabs-2">
    <iframe src="user_info.aspx" id="myFrame" frameborder="0"></iframe>
</div>

jQuery:

jQuery的:

$('#myFrame').load(function () {
    $(this).height($(this).contents().height());
    $(this).width($(this).contents().width());
});

This jQuery makes the IFrame fit it's content. It really does look like it belongs there (it's also borderless), and if you change the page, it stays in the same tab.

这个jQuery使IFrame符合它的内容。它确实看起来像它属于那里(它也是无边界的),如果你更改页面,它将保持在同一个选项卡中。

Screenshot:

截图:

Jquery Ui标签加载到asp.net中的页面