Coolite Toolkit 笔记二

获得一个对象:
格式:#{控件的Id},
客户端使用: <ext:Button ID="Button6" runat="server" Text="获得控件对象" OnClientClick="alert(#{Button6})" >
</ext:Button> //返回一个[object,Object]对象组
修改:alert(#{Button6}.id) 返回Button6 修改:alert(#{Button6}.text) 返回 获得控件对象
服务端使用: 必须是 拼装在String里面的!


控件取值、赋值的方式:
根据控件属性:
可使用 #{控件的Id}.getText() 或 #{控件的Id}.getValue() 获得控件属性值;
反之使用#{控件的Id}.setText('内容') 或 #{控件的Id}.setText('内容') 设置控件属性值;
-----------------------------------------------------------------------------------------------------
<ext:Button>控件:
<ext:Button ID="Button1" runat="server" Text="获得控件对象" OnClientClick="alert(#{Button1}.getText())" >//返回获得控件对象
        </ext:Button>
<ext:Button ID="Button1" runat="server" Text="获得控件对象" OnClientClick="#{Button1}.setText('设置控件对象内容')" >
</ext:Button> //Text="设置控件控件对象内容"
<ext:Label 控件:   #{控件的Id}.getText();             反之设置:setText('内容')
<ext:TextField 控件:   #{控件的Id}.getValue();             反之设置:setValue('内容')


客户端对话框
操作与ext 3.0相同,
alert使用:
格式:Ext.Msg.alert('标题',‘内容’,'回调函数');
confirm使用:
格式:Ext.Msg.confirm('标题', '你想删除','回调函数');
prompt使用:
格式:Ext.Msg.prompt('title','message',callback);


-------------------------------------------------------------------------------------------------------------------------
<script type="text/javascript">
var showResultText = function(btn, text) {
Ext.Msg.alert('Button Click', 'You clicked the ' + btn + ' button and entered the text "' + text + '".');
};

</script>

<ext:Button ID="Button3" runat="server" Text="获得控件对象" OnClientClick="Ext.Msg.prompt('Title', 'Please enter your name:',showResultText)">
</ext:Button>
---------------------------------------------------------------------------------------------------------------------------

show使用:
<ext:Button ID="Button2" runat="server" Text="获得控件对象" OnClientClick="Ext.Msg.show({title:'Save Changes?',msg: 'Would you like to save your changes?',buttons: Ext.MessageBox.YESNOCANCEL,icon: Ext.Msg.QUESTION});">
</ext:Button>

posted @ 2010-08-05 14:15  William_Chen  阅读(720)  评论(0编辑  收藏  举报