Hello, I have an custom control with an event, Something like this
Partial
Class CustomControl_SearchInherits System.Web.UI.UserControlEnd Class
Therein i have declared an event:
PublicEvent SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)and in the html i have created an Listbox
<ASP:ListboxSelectionMode="Multiple"ID="_Listbox"runat="server"AutoPostBack="true"Height="100%"Width="400px"/>then on the event Listbox.selectedIndexChanged i raise the event SelectedIndexChanged.
ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged RaiseEvent SelectedIndexChanged(sender, e)EndSubNow when i try to hook up a selectedIndex event (from my custom control) on the TRIGGER property from the update panel, it wont work, Why not?, It doesnt even apear in the event property's of my custom control
Could you specify the control composition?
I mean , whether the update panel holds an instance of your CustomControl_Search, or the ListBox itself.
If it is the first case, it is quite natural that the update panel cannot be triggered by the SelectedIndex event of the list box.
Probably you could paste some more code here ?
Yani
Ok. Here is some more code:
This is the definition of the custom control
<%@.ControlLanguage="VB"AutoEventWireup="false"CodeFile="Search.ascx.vb"Inherits="CustomControl_Search"%>
<tablewidth="100%"height="100%"cellspacing="0"cellpadding="0"border="0"id="TableNav">
<trheight="12px">
<tdrowspan="4"style="width: 400px"class="IL">
<ASP:ListboxSelectionMode="Multiple"ID="_Listbox"runat="server"
Height="100%"Width="400px"/></td>
</tr>
</table>
ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged
RaiseEvent SelectedIndexChanged(sender, e)
EndSub
PartialClass CustomControl_Search
Inherits System.Web.UI.UserControl
' declare events
PublicEvent SelectedIndexChanged(ByVal senderAsObject,ByVal eAs system.EventArgs)
PublicEvent Find_Clicked()
' handle event (in customcontrol)
ProtectedSub Listbox_SelectedIndexChanged(ByVal senderAsObject,ByVal eAs System.EventArgs)Handles _Listbox.SelectedIndexChanged
RaiseEvent SelectedIndexChanged(sender, e)
EndSub
EndClass
Then I use this custom contol in an aspx page, with 4 update panels, witch have a trigger on the SelectedIndexChanged event raised by Searchpnl
<tdcolspan="3"><uc4:SearchID="Searchpnl"runat="server/></td>
<cc1:UpdatePanelID="UpdatePanel1"runat="server"RenderMode="Inline">
<ContentTemplate>
-- Content --
</ContentTemplate>
<Triggers><cc1:ControlEventTriggerControlID="Searchpnl"EventName="SelectedIndexChanged"/></Triggers>
</cc1:UpdatePanel>
But I the whole page is updated, and I won't only the update panel to be updated. (that's where its for).
I can't see the SelectedIndexChanged event in the property's. I can't see it in the task pane from the updatepanel either.
If you want to get only the update panel updated, you need to put your search control into the update panel.
Other wise it wouldn't know whether to make a regular page post back or an ajax one.
If it does not work try registering your search control in the script manager
ScriptManager1.RegisterAsyncPostBackControl(Searchpnl);
Cheers,
Yani
While we work closely with the ASP.NET AJAX team when developing the Toolkit, they're the real experts on general ASP.NET AJAX issues. Your problem doesn't seem to be directly related to the Toolkit, so we'd appreciate if you considered posting to one of theother newsgroups such asAJAX Discussion and Suggestions. Your post will be more helpful to others looking for similar advice if it's in the right place. Thank you!
hi,
how can an activex control trigger an event of the parent form's control?
for example, I have an activex control which is a button that when clicked, it will output the content of a textbox.
Public Function setText(txt As String)
msg = txt
End Function
Private Sub Button_login_Click()
MsgBox msg
End Sub
After the msgbox is displayed, I want to clear the text in the textbox located in the parent form.
Any idea?
thanks!
Sheila
No comments:
Post a Comment