Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all articles
Browse latest Browse all 5678

AsyncPostPack Trigger not working. Pls help.

$
0
0

Hi expert,

First, I hope I am in the right forum section regarding my question. If not, please pardon me and direct me to the right forum

I have been trying to use UpdatePanel to do partial Update but I do not know what to do in order for the whole thing to work.

My latest experiment shows that the label will change but then the update is reading on the dropdownlist control and not on the radioButton control:

When I click on the Radio Button, nothing changes.  I need it to change the label with data to be emptied when the radio button is clicked.

Now, when I do the dropdownlist a 2nd time, the datab becomes emptied so it is just reading on the dropdownlist control and not on the radio button control.

I'd like to know if updatePanel cannot use the same event name - SelectedIndexChanged?

What should I do in this case for the radioButton Trigger AsynPostBackTrigger to work and the labels with the text to be gone.

Here's my html code :

 private void BindDropdownlist()
        {
 DataTable dtSupplier = eBiz.BindSupplier();
            ddlSupplier.DataSource = dtSupplier;
            ddlSupplier.DataTextField = "SupplierName";
            ddlSupplier.DataValueField = "SupplierName";
            ddlSupplier.DataBind();
            ddlSupplier.Items.Insert(0, new ListItem("--Select--", "0"));
}

protected void ddl1_SelectedIndexChanged(object sender, EventArgs e)
        {
            FetchData();
        }

private void FetchData()
        {
            DataTable dt = new DataTable();
            String sql = "SELECT * from dbo.EPMT_MASTER_SUPPLIER where SUPPLIERName = '" + ddlSupplier.SelectedItem.Text + "' ";
            SqlCommand cmd = new SqlCommand(sql, con);
            cmd.Connection.Open();
            cmd.ExecuteNonQuery();
            SqlDataAdapter ad = new SqlDataAdapter(cmd);
            ad.Fill(dt);
            if (dt.Rows.Count > 0)
            {
                //If you want to get mutiple data from the database then you need to write a simple looping
                txtSupplierEmail.Text = dt.Rows[0]["SupplierEmail"].ToString();
                txtSupplierName.Text = dt.Rows[0]["SupplierName"].ToString();
                txtSupplierCttPerson.Text = dt.Rows[0]["SupplierContact"].ToString();
                txtSupplierCttNumber.Text = dt.Rows[0]["SupplierCttPerson"].ToString();
            }
            cmd.Connection.Close();
        }

// 28 Dec 2016
        // modify on 7 Jan 2017
        protected void RtbOtherVendor_SelectedIndexChanged(object sender, EventArgs e)
        {
            // use User entered infor - use Insert ?
            if (RtbOtherVendor.SelectedValue == "Yes")
            {
                //if (!IsPostBack)
                    lblSupplierEmail.Text = "Refreshed at " +
            DateTime.Now.ToString();
                //txtSupplierEmail.Text = string.Empty;
                txtSupplierName.Text = string.Empty;
                txtSupplierName.Text = string.Empty;
                txtSupplierCttPerson.Text = string.Empty;
                txtSupplierCttNumber.Text = string.Empty;
                txtSupplierEmail.Text = string.Empty;
                txtSupplierName.Text = string.Empty;
                txtSupplierCttPerson.Text = string.Empty;
                txtSupplierCttNumber.Text = string.Empty;
            }
        }

private void UpdateSupplier()
        {
            var s = new Supplier();
            s.SuppEmail = txtSupplierEmail.Text;
            s.SuppName = txtSupplierName.Text;
            s.SuppCttPerson = txtSupplierCttPerson.Text;
            s.SuppContact = txtSupplierCttNumber.Text;
            s.SuppEmail = txtSupplierEmail.Text;
            s.SuppName = txtSupplierName.Text;
            s.SuppCttPerson = txtSupplierCttPerson.Text;
            s.SuppContact = txtSupplierCttNumber.Text;
            DataTable dt = eBiz.InsertSupplierChanged(s.SuppName, s.SuppCttPerson, s.SuppEmail, s.SuppContact);

        }

Hope someone can point out the reason ...cos it's my first time doing this asp.net update panel. Tks.


Viewing all articles
Browse latest Browse all 5678

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>