Hi All,
I am creating a control with ASP "ListBox" control.
Also I have added necessary code to handle the ListBox.SelectedItemChanged
Event.
But surprisingly the control is not comng to this code at all.
Why my ListBox Control in my Web Control is not Raising the
SelectedIndexChanged Event ?
Any suggestions please?
Thanks
Anand Ganeshdid you set the AutoPostBack property to true?
<asp:listbox ... AutoPostBack="True" />
Karl
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
"msnews.microsoft.com" <aganesh@.nobel-systems.com> wrote in message
news:%23i0MFQ5SFHA.1040@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> I am creating a control with ASP "ListBox" control.
> Also I have added necessary code to handle the ListBox.SelectedItemChanged
> Event.
> But surprisingly the control is not comng to this code at all.
> Why my ListBox Control in my Web Control is not Raising the
> SelectedIndexChanged Event ?
> Any suggestions please?
> Thanks
> Anand Ganesh
>
>
Yes I did. Here is the code.
protected override void CreateChildControls()
{
foreach(string st in this.GlobalArrayList)
{
TheListBox.Items.Add(st) ;
}
TheListBox.Attributes.Add("AutoPostBack","True") ;
TheListBox.Attributes.Add("id","ListBoxCheck") ;
TheListBox.Attributes.Add("runat","server") ;
TheListBox.Attributes.Add("OnSelectedIndexChanged","TheListBox_SelectedIndex
Changed")
;
this.Controls.Add(TheListBox) ;
Button TheButton = new Button() ;
TheButton.Click +=new EventHandler(TheButton_Click);
this.Controls.Add(TheButton) ;
//base.CreateChildControls ();
}
But still the TheListBox_SelectedIndexChanged function is not being called.
I am using the CreateChildControls() function to create my controls and I am
not overiding and using the render function.
Will this cause an issue?
Thank
Anand
"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:ekyY$z5SFHA.3636@.TK2MSFTNGP14.phx.gbl...
> did you set the AutoPostBack property to true?
> <asp:listbox ... AutoPostBack="True" />
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/ - New and Improved (yes, the popup is annoying)
> http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
> come!)
>
> "msnews.microsoft.com" <aganesh@.nobel-systems.com> wrote in message
> news:%23i0MFQ5SFHA.1040@.TK2MSFTNGP10.phx.gbl...
>
On Wed, 27 Apr 2005 20:09:08 -0700 in
microsoft.public.dotnet.framework.aspnet, "msnews.microsoft.com"
<aganesh@.nobel-systems.com> wrote:
>TheListBox.Attributes.Add("AutoPostBack","True") ;
>TheListBox.Attributes.Add("id","ListBoxCheck") ;
>TheListBox.Attributes.Add("runat","server") ;
>TheListBox.Attributes.Add("OnSelectedIndexChanged","TheListBox_SelectedInde
xChanged")
>;
>
Hi,
The 'attributes' collection you are adding to, is for client-side
attributes only. Instead, use the appropriate property of the ListBox
control like this:
TheListBox.AutoPostBack = true;
TheListBox.ID = "ListBoxCheck";
TheListBox.SelectedIndexChanged += new
EventHandler(TheListBox_SelectedIndexCha
nged);
Roger
Thanks a lot Roger it Worked.
"Roger Helliwell" <rhelliwell@.telus.net> wrote in message
news:ea017193prs851irdkc47c22ipfvvbrdbh@.
4ax.com...
> On Wed, 27 Apr 2005 20:09:08 -0700 in
> microsoft.public.dotnet.framework.aspnet, "msnews.microsoft.com"
> <aganesh@.nobel-systems.com> wrote:
>
> Hi,
> The 'attributes' collection you are adding to, is for client-side
> attributes only. Instead, use the appropriate property of the ListBox
> control like this:
> TheListBox.AutoPostBack = true;
> TheListBox.ID = "ListBoxCheck";
> TheListBox.SelectedIndexChanged += new
> EventHandler(TheListBox_SelectedIndexCha
nged);
> Roger
>
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment