PDA

View Full Version : [CLOSED] how to show a hidden fieldcontainer?



hdsoso
Mar 16, 2014, 12:14 PM
<script>
var show = function () {
App.fc_login.show();
};
</script>
<ext:RadioGroup runat="server" AnchorHorizontal="100%" LabelWidth="120" FieldLabel="用户状态" Padding="4">
<Items>
<ext:Radio runat="server" FieldLabel="已注册" LabelWidth="50">
<Listeners>
<Change Fn="show"></Change>
</Listeners>
</ext:Radio>
<ext:Radio runat="server" FieldLabel="未注册" LabelWidth="50"></ext:Radio>
</Items>
</ext:RadioGroup>
<ext:FieldContainer runat="server" ID="fc_login" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass"></ext:TextField>
</Items>
</ext:FieldContainer>

fc_login has not show method?
what's the different tag hidden="true" and visiable = "false"?

Daniil
Mar 17, 2014, 5:44 AM
Hi @hdsoso,

A FieldContainer has the show method and your code appears to be working for me.

I have the only guess - "App.fc_login" is not defined for you, because you might use a user control or a master page.

hdsoso
Mar 17, 2014, 6:58 AM
<script>
var buyfun = function (item, command, record, recordIndex, cellIndex) {
App.direct.BuyVhost(record.data.id);
};
var show = function () {
App.fc_login.show();
};
</script>
<ext:Window runat="server" Title="身份认证" ID="user_rz" Width="320" Layout="HBoxLayout" Height="300" Hidden="True">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center" />
</LayoutConfig>
<Items>
<ext:FormPanel runat="server" Layout="AnchorLayout" Width="300" Margin="4">
<Items>
<ext:RadioGroup runat="server" AnchorHorizontal="100%" LabelWidth="120" FieldLabel="用户状态" Padding="4">
<Items>
<ext:Radio runat="server" FieldLabel="已注册" LabelWidth="50">
<Listeners>
<Change Fn="show"></Change>
</Listeners>
</ext:Radio>
<ext:Radio runat="server" FieldLabel="未注册" LabelWidth="50"></ext:Radio>
</Items>
</ext:RadioGroup>
<ext:FieldContainer runat="server" ID="fc_login" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass"></ext:TextField>
</Items>
</ext:FieldContainer>
<ext:FieldContainer runat="server" ID="fc_reg" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="确认密码" ID="tf_pass2"></ext:TextField>
</Items>
</ext:FieldContainer>
</Items>
<Buttons>
<ext:Button runat="server" Text="登陆" Hidden="True"></ext:Button>
<ext:Button runat="server" Text="注册" Hidden="True"></ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>



[DirectMethod]
public void BuyVhost(string id)
{
if (Session["user"] == null)
{
user_rz.Show();
}
else
{

}
}

the fieldcontainer is in the window which is hidden

Daniil
Mar 17, 2014, 8:04 AM
Ok, I am showing the Window, then click a Radio and the FieldContainer appears for me.

hdsoso
Mar 17, 2014, 8:37 AM
Ok, I am showing the Window, then click a Radio and the FieldContainer appears for me.


the window is hidden at first , then is show by directmethod.

hdsoso
Mar 17, 2014, 8:42 AM
Ok, I am showing the Window, then click a Radio and the FieldContainer appears for me.

could you give me your example code?

hdsoso
Mar 17, 2014, 8:43 AM
my full code is below


<%@ Page Title="" Language="C#" MasterPageFile="~/service.master" AutoEventWireup="true" CodeBehind="hosts.aspx.cs" Inherits="extdemo.hosts" %>

<%@ Register Assembly="obout_Window_NET" Namespace="OboutInc.Window" TagPrefix="owd" %>

<%@ Register Assembly="obout_Grid_NET" Namespace="Obout.Grid" TagPrefix="cc1" %>
<%@ Register TagPrefix="obout" Namespace="Obout.Grid" Assembly="obout_Grid_NET, Version=7.0.9.0, Culture=neutral, PublicKeyToken=5ddc49d3b53e3f98" %>
<%@ Register TagPrefix="obout" Namespace="Obout.Ajax.UI.TreeView" Assembly="Obout.Ajax.UI, Version=2.13.925.2, Culture=neutral, PublicKeyToken=24f3c5cea456f322" %>

<asp:Content ID="Content1" ContentPlaceHolderID="cph_head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cph_cont" runat="server">
<script>
var buyfun = function (item, command, record, recordIndex, cellIndex) {
App.direct.BuyVhost(record.data.id);
};
var show = function () {
App.fc_login.show();
};
</script>
<div class="son_main">

<p class="sc_site"><b>你现在的位置:</b><a href="default.aspx">奇卓网络</a> &gt; <a href="servs.aspx">服务内容</a>&gt; <a href="hosts.aspx">域名和主机</a></p>

<h1 id="hdsoso_domain_host">域名和主机<span>domain and host /</span></h1>

<ext:ResourceManager runat="server" SourceFormatting="True" RenderScripts="CDN" RenderStyles="CDN"></ext:ResourceManager>
<ext:Window runat="server" Title="身份认证" ID="user_rz" Width="320" Layout="HBoxLayout" Height="300" Hidden="True">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center" />
</LayoutConfig>
<Items>
<ext:FormPanel runat="server" Layout="AnchorLayout" Width="300" Margin="4">
<Items>
<ext:RadioGroup runat="server" AnchorHorizontal="100%" LabelWidth="120" FieldLabel="用户状态" Padding="4">
<Items>
<ext:Radio runat="server" FieldLabel="已注册" LabelWidth="50">
<Listeners>
<Change Fn="show"></Change>
</Listeners>
</ext:Radio>
<ext:Radio runat="server" FieldLabel="未注册" LabelWidth="50"></ext:Radio>
</Items>
</ext:RadioGroup>
<ext:FieldContainer runat="server" ID="fc_login" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass"></ext:TextField>
</Items>
</ext:FieldContainer>
<ext:FieldContainer runat="server" ID="fc_reg" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="确认密码" ID="tf_pass2"></ext:TextField>
</Items>
</ext:FieldContainer>
</Items>
<Buttons>
<ext:Button runat="server" Text="登陆" Hidden="True"></ext:Button>
<ext:Button runat="server" Text="注册" Hidden="True"></ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
<ext:TabPanel runat="server" Width="1000">
<Items>

<ext:GridPanel runat="server" Title="虚拟主机参数表" Width="1000">
<Store>
<ext:Store runat="server" ID="s_vhost" OnReadData="LoadAllVhost">
<Model>
<ext:Model ID="Model2" runat="server" IDProperty="id" Name="m_vhost">
<Fields>
<ext:ModelField Name="id"></ext:ModelField>
<ext:ModelField Name="name"></ext:ModelField>
<ext:ModelField Name="space"></ext:ModelField>
<ext:ModelField Name="datacenter"></ext:ModelField>
<ext:ModelField Name="panel"></ext:ModelField>
<ext:ModelField Name="dbtype"></ext:ModelField>
<ext:ModelField Name="dbspace"></ext:ModelField>
<ext:ModelField Name="concurrency"></ext:ModelField>
<ext:ModelField Name="flow"></ext:ModelField>
<ext:ModelField Name="provider"></ext:ModelField>
<ext:ModelField Name="os"></ext:ModelField>
<ext:ModelField Name="bandwidth"></ext:ModelField>
<ext:ModelField Name="price"></ext:ModelField>
<ext:ModelField Name="domains"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:PageProxy></ext:PageProxy>
</Proxy>

</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column runat="server" DataIndex="id" Text="编号" Locked="true"
Width="40">
</ext:Column>
<ext:Column ID="Column5" runat="server" DataIndex="name" Text="名称" Width="123">
</ext:Column>
<ext:Column ID="Column6" runat="server" DataIndex="space" Text="网页容量(m)"></ext:Column>
<ext:Column ID="Column7" runat="server" DataIndex="datacenter" Text="数据中心"></ext:Column>
<ext:Column ID="Column8" runat="server" DataIndex="panel" Text="面板"></ext:Column>
<ext:Column ID="Column9" runat="server" DataIndex="dbtype" Text="数据库类型"></ext:Column>
<ext:Column ID="Column10" runat="server" DataIndex="dbspace" Text="数据库容量(m)"></ext:Column>
<ext:Column ID="Column11" runat="server" DataIndex="concurrency" Text="并发(个)"></ext:Column>
<ext:Column ID="Column12" runat="server" DataIndex="flow" Text="月流量(g)"></ext:Column>
<ext:Column ID="Column14" runat="server" DataIndex="os" Text="操作系统"></ext:Column>
<ext:Column ID="Column15" runat="server" DataIndex="bandwidth" Text="带宽(m)"></ext:Column>
<ext:Column ID="Column16" runat="server" DataIndex="price" Text="价格(元)"></ext:Column>
<ext:Column ID="Column13" runat="server" DataIndex="domains" Text="域名"></ext:Column>
<ext:CommandColumn runat="server" Text="操作">
<Commands>
<ext:GridCommand Icon="CartAdd" Text="购买" CommandName="buy">
<ToolTip Text="购买" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Fn="buyfun" />
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
<BottomBar>
<ext:Toolbar ID="Toolbar2" runat="server">
<Items>
<ext:PagingToolbar ID="PagingToolbar2" runat="server" StoreID="s_vhost"></ext:PagingToolbar>
<ext:Label runat="server" Text="-1表示容量共享"></ext:Label>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>
<ext:GridPanel ID="GridPanel1" runat="server" Title="域名参数表">
<Store>
<ext:Store runat="server" ID="s_domain" PageSize="10" RemoteSort="True" OnReadData="LoadAllDomain">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="suffix" Name="m_domain">
<Fields>
<ext:ModelField Name="suffix"></ext:ModelField>
<ext:ModelField Name="reg_price"></ext:ModelField>
<ext:ModelField Name="renew_price"></ext:ModelField>
<ext:ModelField Name="transfer_price"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
<Proxy>
<ext:PageProxy></ext:PageProxy>
</Proxy>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="Column1" runat="server" DataIndex="suffix" Text="域名" Flex="1">
</ext:Column>
<ext:Column ID="Column2" runat="server" DataIndex="reg_price" Text="注册价格(元)">
</ext:Column>
<ext:Column ID="Column3" runat="server" DataIndex="renew_price" Text="续费价格(元)">
</ext:Column>
<ext:Column ID="Column4" runat="server" DataIndex="transfer_price" Text="转移价格(元)">
</ext:Column>
</Columns>
</ColumnModel>
<BottomBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:PagingToolbar ID="PagingToolbar1" runat="server" StoreID="s_domain"></ext:PagingToolbar>
</Items>
</ext:Toolbar>
</BottomBar>
</ext:GridPanel>
</Items>
</ext:TabPanel>



</div>

<script src="images/jquery-1.6.min.js"></script>
<script>
$(function () {
$('.sc_nav a').removeClass("sc_sy");
$('#nav_2').addClass("sc_sy");
});
</script>
<div style="height: 10px;"></div>
</asp:Content>





using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Dao;
using Ext.Net;
using model.crm.hdsoso.com;
using Service;

namespace extdemo
{
public partial class hosts : System.Web.UI.Page
{
readonly DomainService _domainService = new DomainService();
VhostDao _vhostDao = new VhostDao();
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Page.Title = "域名与主机-服务内容-奇卓网络";
this.Page.MetaKeywords = "域名价格,主机价格";
this.Page.MetaDescription = "奇卓网络域名与空间价格表";
}

}
public void LoadAllDomain(object sender, StoreReadDataEventArgs e)
{
var sorters = e.Sort;
var start = e.Start;
var limit = e.Limit;
int total;
var prop = string.Empty;
var direct = string.Empty;
var l = new List<QizDomain>();
if (sorters.Length > 0)
{
var dataSorter = sorters[0];
prop = dataSorter.Property;
direct = dataSorter.Direction == Ext.Net.SortDirection.ASC ? "asc" : "desc";
l = _domainService.AllDomains(start, limit, out total, dataSorter);
}
else
{
l = _domainService.AllDomains(start, limit, out total);
}
e.Total = total;
s_domain.DataSource = l;
s_domain.DataBind();
}
public void LoadAllVhost(object sender, StoreReadDataEventArgs e)
{
var start = e.Start;
var limit = e.Limit;
int total;
var l = _vhostDao.AllVhosts(start, limit, out total);
e.Total = total;
s_vhost.DataSource = l;
s_vhost.DataBind();
}

[DirectMethod]
public void BuyVhost(string id)
{
if (Session["user"] == null)
{
user_rz.Show();
}
else
{

}
}

}
}

Daniil
Mar 17, 2014, 11:43 AM
could you give me your example code?

I've just taken your code.


my full code is below

Please simplify it as much as you can. Also it should be runnable. We should be able to copy, paste and run the sample without any changes from our side.

hdsoso
Mar 22, 2014, 2:09 PM
i notice i use master page , but i do not know how to do, below is my simple example
master page:


<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site2.master.cs" Inherits="extdemo.test.Site2" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">

server master
<div>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>



aspx page :


<%@ Page Title="" Language="C#" MasterPageFile="~/test/Site2.Master" AutoEventWireup="true" CodeBehind="WebForm27.aspx.cs" Inherits="extdemo.test.WebForm27" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
s_store.DataSource = new object[]
{
new object[]{1,"s1"},
new object[]{2,"s2"}
};
s_store.DataBind();
}
}
[DirectMethod]
public void BuyVhost(string id)
{
if (Session["user"] == null)
{
user_rz.Show();
}
else
{

}
}
</script>
<script>

var buyfun = function (item, command, record, recordIndex, cellIndex) {
App.direct.BuyVhost(record.data.id);
};
var show = function () {
App.fc_login.show();
};
</script>


<ext:ResourceManager ID="ResourceManager1" runat="server" SourceFormatting="True"></ext:ResourceManager>
<ext:Window runat="server" Title="身份认证" ID="user_rz" Width="320" Layout="HBoxLayout" Height="300" Hidden="True">
<LayoutConfig>
<ext:HBoxLayoutConfig Pack="Center" />
</LayoutConfig>
<Items>
<ext:FormPanel ID="FormPanel1" runat="server" Layout="AnchorLayout" Width="300" Margin="4">
<Items>
<ext:RadioGroup ID="RadioGroup1" runat="server" AnchorHorizontal="100%" LabelWidth="120" FieldLabel="用户状态" Padding="4">
<Items>
<ext:Radio ID="Radio1" runat="server" FieldLabel="已注册" LabelWidth="50">
<Listeners>
<Change Fn="show"></Change>
</Listeners>
</ext:Radio>
<ext:Radio ID="Radio2" runat="server" FieldLabel="未注册" LabelWidth="50"></ext:Radio>
</Items>
</ext:RadioGroup>
<ext:FieldContainer runat="server" ID="fc_login" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass"></ext:TextField>
</Items>
</ext:FieldContainer>
<ext:FieldContainer runat="server" ID="fc_reg" Hidden="True">
<Items>
<ext:TextField runat="server" FieldLabel="用户名" ID="tf_user1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="密码" ID="tf_pass1"></ext:TextField>
<ext:TextField runat="server" FieldLabel="确认密码" ID="tf_pass2"></ext:TextField>
</Items>
</ext:FieldContainer>
</Items>
<Buttons>
<ext:Button ID="Button1" runat="server" Text="登陆" Hidden="True"></ext:Button>
<ext:Button ID="Button2" runat="server" Text="注册" Hidden="True"></ext:Button>
</Buttons>
</ext:FormPanel>
</Items>
</ext:Window>
<ext:GridPanel ID="GridPanel1" runat="server">
<Store>
<ext:Store runat="server" ID="s_store">
<Model>
<ext:Model ID="Model1" runat="server">
<Fields>
<ext:ModelField Name="id"></ext:ModelField>
<ext:ModelField Name="name"></ext:ModelField>
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel>
<Columns>
<ext:Column ID="Column1" runat="server" DataIndex="id"></ext:Column>
<ext:Column ID="Column2" runat="server" DataIndex="name" Flex="1"></ext:Column>
<ext:CommandColumn ID="CommandColumn1" runat="server" Text="操作">
<Commands>
<ext:GridCommand Icon="CartAdd" Text="购买" CommandName="buy">
<ToolTip Text="购买" />
</ext:GridCommand>
</Commands>
<Listeners>
<Command Fn="buyfun" />
</Listeners>
</ext:CommandColumn>
</Columns>
</ColumnModel>
</ext:GridPanel>


</asp:Content>

Daniil
Mar 22, 2014, 2:44 PM
A JavaScript error should occur here.

App.fc_login.show();

A Control's client id is prefixed with an INamingContainer's ID by default. A Master Page is INamingContainer.

You can wrap the <script> in <ext:XScript> and use "#{App.fc_login}" instead of "App.fc_login".

hdsoso
Mar 23, 2014, 12:50 AM
A JavaScript error should occur here.

App.fc_login.show();

A Control's client id is prefixed with an INamingContainer's ID by default. A Master Page is INamingContainer.

You can wrap the <script> in <ext:XScript> and use "#{App.fc_login}" instead of "App.fc_login".
thank you


<ext:XScript runat="server">
<script>
var buyfun = function (item, command, record, recordIndex, cellIndex) {
App.direct.BuyVhost(record.data.id);
};
var show1 = function () {
#{fc_login}.show();
};
</script>
</ext:XScript>

work fine.