弹出页面控件:ASPxPopupControl,
class="brush:csharp;gutter:true;"><dxpc:ASPxPopupControl ID="popubCtr" runat="server" CloseAction="CloseButton" Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="popubCtr" HeaderText="Customer" AllowDragging="True" EnableAnimation="False" Height="500" AllowResize="True" Width="600" EnableViewState="False"> </dxpc:ASPxPopupControl>
按钮实现打开子窗体,方法:PopupPartyAdr
<tr> <td> <dxe:ASPxButton ID="ASPxButton11" runat="server" HorizontalAlign="Left" Width="95" Text="Pick" AutoPostBack="False"> <ClientSideEvents Click="function(s, e) { PopupPartyAdr(null,txt_Ref_H_CltFrm); }" /> </dxe:ASPxButton> </td> <td> <dxe:ASPxMemo ID="txt_Ref_H_CltFrm" Rows="4" Width="440" ClientInstanceName="txt_Ref_H_CltFrm" runat="server" Text='<%# Eval("HaulierCollect") %>'> </dxe:ASPxMemo> </td> </tr>
js实现弹出子窗体 popubCtr.SetContentUrl("")为子窗体要连接的功能页面,popubCtr为ASPxPopupControl控件的ClientInstanceName属性的值
function PopupPartyAdr(txtId, txtName) { clientId = txtId; clientName = txtName; popubCtr.SetHeaderText('Party'); popubCtr.SetContentUrl('/SelectPage/PartyList_Adr.aspx?partyType=' + partyType); popubCtr.Show(); }
js实现在弹出的窗体选定某一行的值,将值然后返回父窗体的指定的文本框,刷新父窗体
javascript;gutter:true;">var clientId = null; var clientName = null; function PutValue(s, name) { if (clientId != null) { clientId.SetText(s); } if (clientName != null) { clientName.SetText(name); } popubCtr.Hide(); popubCtr.SetContentUrl('about:blank'); }
子窗体调用ASPxGridView ,在Columns属性中调用PutValue()方法,返回PartyId和Addr的值(Addr为后台通过SQL语句查询到的结果集)
<Columns> <dxwgv:GridViewDataTextColumn Caption="#" VisibleIndex="0" Width="5%"> <DataItemTemplate> <a onclick='parent.PutValue("<%# Eval("PartyId") %>","<%# Eval("Addr") %>");'>Select</a> </DataItemTemplate> <EditItemTemplate> </EditItemTemplate> </dxwgv:GridViewDataTextColumn> <dxwgv:GridViewDataTextColumn Caption="Code" FieldName="Code" VisibleIndex="1" Width="30%"> </dxwgv:GridViewDataTextColumn> <dxwgv:GridViewDataTextColumn Caption="Name" FieldName="Name" VisibleIndex="2"> </dxwgv:GridViewDataTextColumn> </Columns>
string sql = @"SELECT PartyId, Code,Name, REPLACE(REPLACE(NAME,char(34),'\"'),char(39),'\'') + '\n' +REPLACE(REPLACE(REPLACE(LTRIM(REPLACE(Address, CHAR(13) + CHAR(10), '\n')), CHAR(10), '\n'),char(34),'\"'),char(39),'\'')+ '\nTEL:' + Tel1 + ' FAX:' + Fax1 as Addr fROM XXParty where Status='USE'";