命令名称&命令参数 [英] command name & command argument

查看:80
本文介绍了命令名称&命令参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以添加命令名称&文本框中的命令参数

i can add command name & command argument in text box

<asp:TextBox ID="txtpacks" runat="server" SkinID="smalltextBox60px" Text='<%#Eval("Packs") %>'

                                                                                               OnTextChanged="txtPacksunits_textchanged" CommandName="1" CommandArgument="pack"  AutoPostBack="true" MaxLength="9"></asp:TextBox>







<asp:TextBox ID="txtunits" runat="server" SkinID="smalltextBox60px" Text='<%#Eval("Units") %>'

                                                                                               OnTextChanged="txtPacksunits_textchanged" CommandName="2" CommandArgument="units" AutoPostBack="true" MaxLength="9"></asp:TextBox>







两个文本框的相同文本更改事件。

我想要在Chande活动中使用哪个文本框的代码。

请帮助我




same text change event for two text boxes.
I want code for which text box is faired in Chande event .
please help me

推荐答案

嘿那里,



我不知道为什么你需要TextBox的CommandName和CommandArgument,因为它们不是TextBox控件的属性,所以CommandName和CommandArgument将被添加为Attributes TextBox。

这是一个示例,显示如何在事件中获取它们:

Hey there,

I am not sure why do you need CommandName and CommandArgument for TextBox, as these are not properties of TextBox control, so CommandName and CommandArgument will be added as Attributes of the TextBox.
Here is an example showing how you can get them in the event:
protected void TextBox_TextChanged(object sender, EventArgs e)
        {
            TextBox txt = (TextBox) sender;
            string commandArg = txt.Attributes["CommandArgument"].ToString();
            String commandName = txt.Attributes["CommandName"].ToString();
        }





如果有帮助请告诉我。



Azee ......



Let me know if it helps.

Azee...


这篇关于命令名称&amp;命令参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆