Code:
<asp:UpdatePanel ID="MachineUpdate" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="MachineName" style="">
<uc1:MachineNameControl runat="server" ID="MachineNameControl" commandValue="" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
My code in MachineNameControl (ascx file)
public partial class MachineNameControl : System.Web.UI.UserControl
{
public String commandValue { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(commandValue))
{
this.MachineNameDataSource.WhereParameters.Clear();
this.MachineNameDataSource.AutoGenerateWhereClause = false;
this.MachineNameDataSource.Where = "it.Head_Id = " + Convert.ToInt32(commandValue) + " ";
}
else
{
this.MachineNameDataSource.WhereParameters.Clear();
this.MachineNameDataSource.AutoGenerateWhereClause = false;
this.MachineNameDataSource.Where = "it.Head_Id > 0 ";
}
}
}
My Problem in client side (I've tried to change attribute value of usercontrol and refresh the updatepanel, result is still same and nothing happended)
$(function () {
$("#<%= MachineNameControl.ClientID %>").attr("commandValue", "2");
__doPostBack('<%= MachineUpdate.ClientID %>');
}