473,698 Members | 2,546 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Event Not Firing for DropdownList in DataGrid

I am trying to use AutoPostback to retrieve the value that was selected

in my dropdownlist. The event is not firing for the dropdownlist
because the datagrid is being built after the Lifecycle of the Firing
Events. So in order to capture my selected value I need to capture it
in the OnInit when the autopostback fires, but I don't know how I can
do this.

Since the Page Lifecycle fires events before my datagrid gets built
then I can not use the eventhandler for my dropdownlist if anybody has
any help I really could use it.
Thanks,
Adrian
Reply

Apr 17 '06 #1
2 3333
I think you want to create a method that fires when the selected index
changes for the dropdownlist. Its hard to say much else using just the
information you provided.

Apr 17 '06 #2
Here is code for my dropdownlist

private RebarDropDownLi st ObjectNameList
{
get
{
EnsureChildCont rols();
if (nameListValue == null)
{
nameListValue = new RebarDropDownLi st();
nameListValue.R ebarPageSet(thi s.PageCommon()) ;
nameListValue.P artsToRender =
ControlPartsToR ender.ControlOn ly;
nameListValue.S electedIndexCha nged += new
EDS.Rebar.Web.W ebControls.Reba rDropDownList.S electedIndexCha ngedEventHandle r(DropDownListV alue_SelectedIn dexChanged);
nameListValue.A utoPostBack = true;
nameListValue.I D = "objectnameList ";
FillObjectNameL ist();
}
return nameListValue;
}
}
Code for outputing the dropdownlist

private void MetaDataGrid_Ad dHeaderRows(
RebarGrid grid)
{

RebarGridCellHe ader cellHeader;
grid.AddNewHead erRow();

//Blank Cell
cellHeader = grid.AddNewHead erCell();
cellHeader.Text = "Icon";
grid.AddNewHead erRow();
for (Int32 r = 0; r < MetadataHeaders .Count; r++)
{
if (MetadataOption s[r].ToString() == "object_nam e")
{
RebarGridCell cellListHeader = grid.AddNewCell ToHeader();
cellListHeader. Controls.Add(Ob jectNameList);
}
THE "MetaDataGrid_A ddHeaderRows" is in my CreateChildCont rols as
"this.Controls. Add(MetaDataGri d);"

Problem is the eventhandler does not fire because the DataGrid gets
built after the events lifecycle so I'm trying to get the selected
values without using the eventhandler.

Thanks.

Apr 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
17018
by: Dominic | last post by:
Hi guys, I'm not sure if this question belongs to FAQ, but I couldn't find a concrete answer. I created a Datagrid control using ItemTemplate, but it's NOT a in-place editing datagrid. One of the columns of the data grid contains a DropDownlist. I managed to create this datagrid control as follows.
0
5745
by: Oz | last post by:
Hi Using VS.NET 2003, Windows XP SP1, We have a page which has been developed using ASP.NET. On it, is a button which when clicked is supposed to add some data to a table. When the button is selected, it causes the ServerClick event to be called twice. Here's the code: You'll see that there are two grids on the page, and that the function SetupDataGrid populates data to the two grid. There are also
1
1662
by: Stu | last post by:
Hi, I have a button in the footer of a datagrid that sometimes does not tigger the item command. The page is quite large & has a number of homegrown controls in it. Has anyone come across this type of behaviour before? Can anyone suggest a solution? Thanks in advance, Stu
1
3350
by: CurlyFro | last post by:
i have a userControl (.ascx) that has a dropdownlist embedded in a datagrid. the dropdownlist autopostback is set to true. why isn't the selectedIndexChanged firing? Private Sub grdNewVideos_ItemCreated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdNewVideos.ItemCreated If e.Item.ItemType = ListItemType.EditItem Then AddHandler CType(e.Item.FindControl("ddlArtistNames"),...
5
1971
by: csgraham74 | last post by:
Hi guys, I posted regarding this issue the other day but i still dont have an answer to my problem. Basically i have imported asp.net pages from dreamweaver into visual studio. Ive added a few controls that ive copied in from another asp.net page that i built within visual studio. The problem is that the asp:button does not fir an event and therefore my code behind it wont work. The page load event is firing correctly so i think the...
1
2403
by: Andy | last post by:
Hello, I have a datagrid within another datagrid. The innder datagrid contains a dropdownlist which fires an event as index change (OnSelectedIndexChanged). I can get the ItemIndex of the dropdownlist using this code below: ((DataGridItem)((DropDownList)Sender).NamingContainer).ItemIndex; This returns the ItemIndex of the dropdownlist of the inner datagrid.
3
3456
by: danc | last post by:
I have a datagrid with a checkbox and dropdown list in each row. Both set AutoPostBack to true and ItemCommand and OnSelectedIndexChanged events for these controls works fine when DataGrid is not paged. As soon as I turn on paging support, I no longer get events properly for any page except the first. 1) The DataGrid displays the page numbers on the top (and bottom). Whenever I click to go to a specific page number, the DropDownList's...
4
4193
by: TS | last post by:
I am creating a User control and i create some dynamic controls in the init handler. one of the controls is a custom validator which i assign a serverValidate event handler. I usally always do my controls as custom server controls and don't understand why this event won't fire. I figured if the creation of the control was in the init, it would be initialized and have its event handlers set up, then after Load, the control would call its...
2
3919
by: John Kotuby | last post by:
Hi guys, I am converting a rather complicated database driven Web application from classic ASP to ASP.NET 2.0 using VB 2005 as the programming language. The original ASP application works quite well, so at times it is tempting just to port parts of it over mostly as-is. In fact, one MSDN article I read suggested using straight HTML wherever possible to make the app more efficient and less resource demanding. On one page there are 2...
0
8678
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8871
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4371
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.