473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

DropDownListBox and footer and datagrid

kgs
I dynamically added a DropDownListBox to a footer of
datagrid on itemcreated event.
In which event in postback can i access the selected item.

Interesting thing i noted that even though i create it,
every time on postback of the page the selected item is
preserved.

thanks!!!
Nov 18 '05 #1
2 1624
Hi,

you could dynamically wire an event handler for the DDL (when it is created
in ItemCreated) to handle it's SelectedIndexChanged. The DDL just needs to
have AutoPostBack="True" specified if you want postback to happen when
selection changes. Then you wouldn't need to "guess" what's the event to
check it, you just handle DDL's very own SelectedIndexChanged event that is
raised when change in selection is detected. Otherwise, if it is another
control that causes the postback (say ButtonColumn or a Button in the same
DatagridItem), you would search the DDL from current DataGridItem's Controls
collection and just check its selected value.

Yes, it keeps state as postback data for the DDL is loaded (once before
Page_Load and second try after Page_Load) and the selected item is
"restored" that way. Dynamically created controls can keep their state
equivally as static controls as long as they follow certain rules (and it
does here, because DataGrid tahes care of creating the Controls)

--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"kgs" <an*******@discussions.microsoft.com> wrote in message
news:01****************************@phx.gbl...
I dynamically added a DropDownListBox to a footer of
datagrid on itemcreated event.
In which event in postback can i access the selected item.

Interesting thing i noted that even though i create it,
every time on postback of the page the selected item is
preserved.

thanks!!!

Nov 18 '05 #2
kgs
Thank You very much.
-----Original Message-----
Hi,

you could dynamically wire an event handler for the DDL (when it is createdin ItemCreated) to handle it's SelectedIndexChanged. The DDL just needs tohave AutoPostBack="True" specified if you want postback to happen whenselection changes. Then you wouldn't need to "guess" what's the event tocheck it, you just handle DDL's very own SelectedIndexChanged event that israised when change in selection is detected. Otherwise, if it is anothercontrol that causes the postback (say ButtonColumn or a Button in the sameDatagridItem), you would search the DDL from current DataGridItem's Controlscollection and just check its selected value.

Yes, it keeps state as postback data for the DDL is loaded (once beforePage_Load and second try after Page_Load) and the selected item is"restored" that way. Dynamically created controls can keep their stateequivally as static controls as long as they follow certain rules (and itdoes here, because DataGrid tahes care of creating the Controls)
--
Teemu Keiski
MCP, Microsoft MVP (ASP.NET), AspInsiders member
ASP.NET Forum Moderator, AspAlliance Columnist
"kgs" <an*******@discussions.microsoft.com> wrote in messagenews:01****************************@phx.gbl...
I dynamically added a DropDownListBox to a footer of
datagrid on itemcreated event.
In which event in postback can i access the selected item.
Interesting thing i noted that even though i create it,
every time on postback of the page the selected item is
preserved.

thanks!!!

.

Nov 18 '05 #3

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

Similar topics

1
by: Randy | last post by:
Can footers be forced to the bottom of an .ASPX page either using #include or User Controls? I got a page that starts out displaying 3 drop down lists, one text box, 5 labels and 1 Submit Button. ...
0
by: Robert Ashby | last post by:
I have a .jpg footer on my .aspx web page. When the datagrid loads it floats over the top of the web page footer. The footer does not move. I would like to footer to float on the web page and...
2
by: | last post by:
I have gotten the following error in trying to get totals to come out on a footer. Server Error in '/test' Application....
2
by: Mike | last post by:
I have a dropdownlistbox in a template column of a datagrid. I need to be able to respond to the selecteditemchanged event of the dropdownlist, but I am having trouble doing that. I thought I would...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
6
by: tshad | last post by:
I need to get to a status label I have on my footer section of my datalist. There is no event happening that would go to the footer. I am just doing some processing and want to update the label...
1
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...
1
by: .Net Sports | last post by:
the below itemdatabound function works , displays all the grand totals in the footer control of the datagrid: private void dglvboard_ItemDataBound(object sender,...
1
by: jeyapriya | last post by:
Dear Friends This is Jeyapriya. Right now I am working in the ASP.NET with VB coding & the back end is SQL SERVER 2000. My dilemma is I have to design a form with 2 DropDownListboxes. I have...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.