Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何通过单键单击调用多个单击_.net - Fatal编程技术网

.net 如何通过单键单击调用多个单击

.net 如何通过单键单击调用多个单击,.net,.net,我的页面上有两个按钮。我希望当我点击单个按钮时,两个按钮的动作都必须被激活。我在这里分享我的代码 public void Button1_Click(object sender, System.EventArgs e) { Insert(sender, e); **EmployeeFormView_ItemInserting(sender, Insert);** } public void EmployeeFormView_ItemInserting(object sen

我的页面上有两个按钮。我希望当我点击单个按钮时,两个按钮的动作都必须被激活。我在这里分享我的代码

public void Button1_Click(object sender, System.EventArgs e)
{
   Insert(sender, e);
   **EmployeeFormView_ItemInserting(sender,  Insert);** 
}
    public void EmployeeFormView_ItemInserting(object sender, FormViewInsertEventArgs e)
    {


        TextBox SexTextBox = (TextBox)form1.FindControl("SexTextBox");
        TextBox dobTextBox = (TextBox)form1.FindControl("dobTextBox");
        TextBox office_addressTextBox = (TextBox)form1.FindControl("office_addressTextBox");


        SqlConnection conn = new SqlConnection(connStr);
        com.Connection = conn;
        com.CommandText = "INSERT INTO Employees Values('" + SexTextBox.Text + "','" + dobTextBox.Text + "', '" + office_addressTextBox.Text + "')";
        conn.Open();
        com.ExecuteNonQuery();
        Response.Write("Record inserted successfully");
        bindgrid();
        conn.Close();
    }
   public void Insert(object sender, EventArgs e)
    {
        //Lets validate the page first
        if (!Page.IsValid)
            return;

        int intResult = 0;
        // Page is valid, lets go ahead and insert records
        // Instantiate BAL object

        PersonBAL pBAL = new PersonBAL();
    // Instantiate the object we have to deal with
    Person person = new Person();

        // set the properties of the object
        person.a_select_part = DropDownList1.SelectedValue;
        person.a_dalal_name = TextBox2.Text;
        person.a_owner_name = TextBox3.Text;
        person.a_mobile_number = TextBox4.Text;


        try
        {
            intResult = pBAL.research(person);
            if (intResult > 0)
                TextBox1.Text = "pankil";
            else
                TextBox1.Text = "FirstName [<b>" + TextBox1.Text + "</b>] alredy exists, try another name";

        }
        catch (Exception ee)
        {
            TextBox1.Text = ee.Message.ToString();
        }
        finally
        {
            person = null;
            pBAL = null;


        }

    }
public void按钮1\u单击(对象发送者,System.EventArgs e)
{
插入(发件人,e);
**EmployeeFormView_项目插入(发件人,插入);**
}
public void EmployeeFormView\u项目插入(对象发送者,FormViewInsertEventArgs e)
{
TextBox SexTextBox=(TextBox)form1.FindControl(“SexTextBox”);
TextBox dobTextBox=(TextBox)form1.FindControl(“dobTextBox”);
TextBox office\u addressTextBox=(TextBox)form1.FindControl(“office\u addressTextBox”);
SqlConnection conn=新的SqlConnection(connStr);
com.Connection=conn;
com.CommandText=“插入员工值(“+SexTextBox.Text+”、“+dobTextBox.Text+”、“+office_addressTextBox.Text+”)”;
conn.Open();
com.ExecuteNonQuery();
响应。写入(“成功插入记录”);
bindgrid();
康涅狄格州关闭();
}
public void Insert(对象发送方,事件参数e)
{
//让我们先验证页面
如果(!Page.IsValid)
回来
int结果=0;
//页面有效,让我们继续插入记录
//实例化BAL对象
PersonBAL pBAL=新的PersonBAL();
//实例化我们必须处理的对象
Person=新人();
//设置对象的属性
person.a\u select\u part=DropDownList1.SelectedValue;
person.a_dalal_name=TextBox2.Text;
person.a_owner_name=TextBox3.Text;
person.a_mobile_number=TextBox4.Text;
尝试
{
intResult=pBAL.研究(人);
如果(intResult>0)
TextBox1.Text=“pankil”;
其他的
TextBox1.Text=“FirstName[”+TextBox1.Text+“]alredy存在,请尝试其他名称”;
}
捕获(异常ee)
{
TextBox1.Text=ee.Message.ToString();
}
最后
{
person=null;
pBAL=null;
}
}
现在,我应该传递什么样的论点

EmployeeFormView_项目插入(发件人,)


要通过单击一个按钮来执行同一页面中两个按钮的操作,需要调用第一个按钮中第二个按钮的按钮单击事件,即

this.Button2.PerformClick();
给我的错误是“不包含PerformClick()的定义;您正在使用vb.net?或c#?”?