Click here to Skip to main content
14,775,228 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

i have a dropdownlist inside the repeater.
and i have update panel for it,
i want to assign ddl id to the update panel triggers.

But i'm getting control id not found error.

Can any one plz help me, how can i assign this control id to the update panel triggers.

i have this code, but i'm sure where i have to call this.
CODE
//Creates a new async trigger
    AsyncPostBackTrigger trigger = new AsyncPostBackTrigger();

    //Sets the control that will trigger a post-back on the UpdatePanel
    trigger.ControlID = "lnkbtncommit";

    //Sets the event name of the control
    trigger.EventName = "Click";

    //Adds the trigger to the UpdatePanels' triggers collection
    pnlUpdate.Triggers.Add(trigger);


plz help me.

Thanks
Posted
Updated 13-Oct-14 7:55am
v3

1 solution

It might because of your trigger ControlID is out of scope to Trigger collection.Also
You have set lnkbtncommit as the control ID for the update panel. Try setting it like this,

trigger.ControlID = "DropDownList1";
trigger.EventName = "SelectedIndexChanged";


Also you can set your dropdownlist ID for the update panel trigger like below in aspx

<asp:updatepanel id="UpdatePanel1" runat="server">
<triggers>
<asp:asyncpostbacktrigger controlid="DropDownList1" eventname="SelectedIndexChanged" />
</triggers>
<contenttemplate>
.....</contenttemplate></asp:updatepanel>
   
v3
Comments
abdul subhan mohammed 14-Oct-14 1:41am
   
Can u plz explain me, about lnkbtncommit, how to set it n where to set.
Dilan Shaminda 14-Oct-14 7:58am
   
see this example for a datalist:

<div class="singleItem">
<label>
<asp:Button ID="btnQuickSearch" runat="server" CssClass="SubmitButtonStyle" Text="Search" OnClick="btnQuickSearch_Click" />
</label>
</div>

<asp:UpdatePanel ID="updtpnlProducts" runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="btnQuickSearch" EventName="Click" />
</Triggers>
<contenttemplate>
<asp:DataList ID="dlstVehicles" runat="server" RepeatColumns="3" CellSpacing="5"
RepeatDirection="Horizontal" RepeatLayout="Table" OnItemCommand="dlstVehicles_ItemCommand">
<itemtemplate>
.
.
.



abdul subhan mohammed 15-Oct-14 2:01am
   
Dude, i have placed controls in the repeater, like dropdownlist and it has its OnSelectedIndexChanged event, i want to trigger this, of the updatepanel.
Dilan Shaminda 15-Oct-14 2:37am
   
inside OnSelectedIndexChanged bind data to repeater based on the dropdown selection value.It will bind data to repeater without refreshing the page

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900