如何将文本传递给jquery中的代码,在模式弹出窗口中打开gridview [英] How to pass text to code behind in jquery that opens a gridview in modal pop up
问题描述
所以我在网页表单中有几个按钮,执行下面的jquery。
它打开模式弹出,文本附加到标题。 Text是button.Text,它是服务器端功能的参数。
函数 getBinDets(bin)
{
debugger ;
var url = ' DisplayGrid.aspx? param =' + encodeURIComponent(bin)
var frame = $(' < iframe />')。css(' border',' 0')。attr({
' src':url,
' width':' 100%',
' height':' 100%'
});
$( #modalbinDets)
.clear()。append( frame)
.dialog({
title: Bin Details: + bin,
dialogClass:' dialog_style1',
autoOpen: true ,
modal: true ,
height: 300 ,
宽度: 600 ,
open: function ( event,ui){
$(' #modalbinDets')。css(' 溢出',' hidden');
},
按钮:{
关闭:功能(){
$(此)。对话框( close)
}
}
})。prev( 。ui-dialog-titlebar).css( background, lightblue);
}
现在,我想在模态弹出窗口中绑定Gridview < br $>
服务器端方法:
受保护 Sub Page_Load( ByVal sender As 对象, ByVal e As System.EventArgs )句柄 我。加载
如果 不 Page.IsPostBack 然后
BinItems()
结束 如果
结束 Sub
公共 Sub BinItems( ByVal bin As 字符串)
Dim ds 作为 新 DataSet
Dim 数据作为 新列表( 字符串)
尝试
ds = db.displayAnalysis( 14 ,bin)
GridView1.DataSource = ds.Tables( 0 )
GridView1.DataBind()
Catch ex As 例外
结束 尝试
结束 Sub
我首先在页面加载中绑定一个虚拟行。
我的网格如下所示
< div id = modalbinDets >
< asp:GridView ID = GridView1 runat = server AllowPaging = true < span class =code-attribute> AutoGenerateColumns = false >
< 列 >
< asp:BoundField ItemStyle-Width = 150px DataField = baitem HeaderText < span class =code-keyword> = 项目 / >
< asp:BoundField ItemStyle-Width = 150px DataField = baqoh HeaderText = 现有 < span class =code-attribute> / >
< asp:BoundF ield ItemStyle-Width = 150px DataField = baqcm HeaderText = 已提交 / >
< ; asp:BoundField ItemStyle-Width = 150px < span class =code-attribute> DataField = available HeaderText = 可用 / >
< asp:BoundField ItemStyle-Width = 150px DataField = onhold < span class =code-attribute> HeaderText = 暂停 / >
< asp:BoundField ItemStyle-Width = 150px DataField = icdsc1 HeaderText = icdsc1 / >
< asp:BoundField ItemStyle-Width < span class =code-keyword> = 150px DataField = icdsc2 HeaderText = icdsc2 / >
< /列 >
< / asp:GridView >
< / div >
我尝试了什么:
到目前为止,我已经尝试了模态弹出,获得单击按钮的文本和我的数据集背后的代码已准备就绪。
我不知道如何将文本传递给代码隐藏函数(如下所示)。并在结果弹出窗口中绑定结果。
有人可以帮我这个吗?
< blockquote>(' < iframe />')。css(' border',' 0')。attr({
' src':url,
' width':' 100%',
' height':' 100%'
});
( #modalbinDets)
.clear()。append(frame)
.dialog({
title: Bin Details : + bin,
dialogClass:' dialog_style1',
autoOpen: true ,
modal: true ,
height: 300 ,
宽度: 600 ,
open: function (event,ui){
(' # modalbinDets')。css(' overflow',' hidden');
},
按钮:{
关闭:功能(){
So I have few buttons in a web form where, the below jquery is executed.
It opens the modal pop up with the Text appended to Title. And the Text is button.Text which is a parameter to server side function.
function getBinDets(bin)
{
debugger;
var url = 'DisplayGrid.aspx?param=' + encodeURIComponent(bin)
var frame = $('<iframe/>').css('border', '0').attr({
'src':url,
'width': '100%',
'height':'100%'
});
$("#modalbinDets")
.clear().append(frame)
.dialog({
title: "Bin Details: " + bin,
dialogClass: 'dialog_style1',
autoOpen: true,
modal: true,
height: 300,
width: 600,
open: function (event, ui) {
$('#modalbinDets').css('overflow', 'hidden');
},
buttons: {
Close: function () {
$(this).dialog("close")
}
}
}).prev(".ui-dialog-titlebar").css("background", "lightblue");
}
Now, I want to bind the Gridview in the modal pop up
server side method :
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
BinItems()
End If
End Sub
Public Sub BinItems(ByVal bin As String)
Dim ds As New DataSet
Dim data As New List(Of String)
Try
ds = db.displayAnalysis("14", bin)
GridView1.DataSource = ds.Tables(0)
GridView1.DataBind()
Catch ex As Exception
End Try
End Sub
I am binding a dummy row in page load first.
And my grid is like below
<div id="modalbinDets" >
<asp:GridView ID="GridView1" runat="server" AllowPaging="true" AutoGenerateColumns="false">
<Columns>
<asp:BoundField ItemStyle-Width="150px" DataField="baitem" HeaderText="Item" />
<asp:BoundField ItemStyle-Width="150px" DataField="baqoh" HeaderText="On Hand" />
<asp:BoundField ItemStyle-Width="150px" DataField="baqcm" HeaderText="Committed" />
<asp:BoundField ItemStyle-Width="150px" DataField="available" HeaderText="Available" />
<asp:BoundField ItemStyle-Width="150px" DataField="onhold" HeaderText="On Hold" />
<asp:BoundField ItemStyle-Width="150px" DataField="icdsc1" HeaderText="icdsc1" />
<asp:BoundField ItemStyle-Width="150px" DataField="icdsc2" HeaderText="icdsc2" />
</Columns>
</asp:GridView>
</div>
What I have tried:
So far, I have tried the modal pop, getting the Text of clicked button and my code behind dataset with results are ready.
I do not know how to pass the text to code behind function(as below). And bind the results in Gridview on modal pop up.
Can someone please help me with this?
('<iframe/>').css('border', '0').attr({ 'src':url, 'width': '100%', 'height':'100%' });
("#modalbinDets") .clear().append(frame) .dialog({ title: "Bin Details: " + bin, dialogClass: 'dialog_style1', autoOpen: true, modal: true, height: 300, width: 600, open: function (event, ui) {
('#modalbinDets').css('overflow', 'hidden'); }, buttons: { Close: function () {
这篇关于如何将文本传递给jquery中的代码,在模式弹出窗口中打开gridview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!