<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 %>');
}
Based on the coding in above, I've tried to change attributes value of '<%= MachineNameControl.ClientID %>' and refresh the content in updatepanel by calling __doPostBack('<%= MachineUpdate.ClientID %>'). Result is same and nothing change to filter record? Can anyone give me a guide, please.Thank!!
RE: How to change attributes value of user control in div
You will not be able to set a server object's property through client side script.
Using the .prop() or .attr() only affects the dom object (what html is renders) not the value of an actual property.
RE: How to change attributes value of user control in div
RE: How to change attributes value of user control in div
Using the .prop() or .attr() only affects the dom object (what html is renders) not the value of an actual property.
RE: How to change attributes value of user control in div