Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Oct 19, 2011 04:02 PM by viperx1967dag
Sep 06, 2011 05:12 PM|LINK
I have created a custom datapager control, part of the control I have added image buttons for the ability to tie in Add, Delete, Edit, and Search events. We use this control in conjunction with a Listview control via the PagerControlID property. When any
button is clicked it has OnClientEvent jquery code that allows us to control the actions via jquery dialogs. When the data is collected we then do the ___doPostBack(o.name,'') "o" being the button control that is passed in via the OnClientClick Event. We then
handle the OnPagerCommand and based on the CommandName of the button determine what event is to take place IE. Add, Delete,......
The listview is databound using an ObjectDataSource Control via Objects that are returned as List<T>'s. All seems to work fine when we have data but when no data is returned is where the issue resides.
This all seems to work well in a MasterPage, Page and Child Control situation but when we put the custom control on a page in a
Nested Masterpage the OnPagerCommand Event doesn't fire. Now to add even more confusion if we have records in the listview the OnPagerCommand gets the event and fires fine.
To add even more confusion, if the control is on a page with a Master Page it seems to work fine with or without records in the listview.
I think i have narrowed it down to be an issue with Nested Master Pages but do not have a resolution. Any help on this would be appreciated.
Sep 08, 2011 02:41 AM|LINK
but when we put the custom control on a page in a Nested Masterpage the OnPagerCommand Event doesn't fire.
What's customer control?
What's a nested master page?
Can you show us your screenshots as well as your codes (both aspx and cs ones???)
Sep 08, 2011 03:14 PM|LINK
Unfortunately I cannot post the code or images of the site to the forum. Let me try and explain problem in more detail.
I have a asp.net custom server control i created that consists of a DataPager Control with a TemplatePagerField.
On the TemplatePagerField I implement the OnPagerCommand Event which is what i use to handle all messages from the child Controls in the TemplatePagerField.
In the TemplatePagerField I have ImageButtons that control aspects of the DataPager Control I implemented a custom paging mechnism that allows for Last, Next , Previous and First Records.
I also have a dropdown list in the TemplatePagerField that shows the pages and allows direct page selection. Very similar to the example at
I have also added 4 Image Control Buttons that support Add, Edit, Delete, and Search.
When a command of anything but First, Next, Previous or Last is sent them to a CustomEventHandler that then posts the event that can be handled on the page that is implementing my Custom Control.
So basically the OnPagerCommand Fires passes the command I then pass that event back up to the parent so it can be handled.
Example when someone hosts the control they implement the following:
<cc1:CustomPager id="CustomPager" PagedControlID="ListView1" runat="server" OnPagerCommand="PagerCommand"/>
protected void PagerCommand(object sender,CustomPagerEventArgs e)
if(e.Command == "Add")
///Do Add method here
ListView1 is the Listview control on the page that displays the data.
Now if I put this custom control on a Page that has a MASTER page all of the events work fine and everything works as it should I get the event posted to the Custom Controls DataPager Control OnPagerCommand event and it gets posted in a custom Event Handler
back to the parent page and is handled in the PagerCommand function.
If I put the Custom control on a Page that has a NestedMasterPage which has a MasterPage is where the problem occurs.
If the Listview has data then the events work fine and I can use the add, edit, delete and the event gets passed back up to the page's PagerCommand
If the Listview has no data then button event gets fired I can see it on the page load but is never passed to the OnPagerCommand of the DataPager Control which in turn does not get posted back to the hosted pages PagerCommand.
Hope this clears up any confusion.
Sep 15, 2011 08:42 AM|LINK
Have you tried to set breakpoint in the control code and start debuging to see if it is fired?
Sep 20, 2011 02:57 PM|LINK
Yes obviously that is how I can see the event is being posted to the page.
The Event is Fired to the Page but not passed to the Child Control. It seems to be a out of sync issue.
My theory is that the nested page and custom control is not created yet for the event to be passed to the proper handler.
Sep 23, 2011 06:59 AM|LINK
I built a solution with DataPager and ListView of .Net in nested MasterPage. It works ok.
To drive forward, need source code for review.
Oct 19, 2011 04:02 PM|LINK
Unfortunately I cannot post the code due to a number of different reasons.
Basically the model is
----Nested Master Page
The event gets passed from the master page thru the page itself but does not get forwarded on to be handled by the CustomDatapagerControl One of the issues I have found is that the Nested Master Page does not get created until after the Page which I believe
is part of the syncronization issue I am having is that the event is being posted properly but due to sync the CustomDatapager control does not exist or is out of scope at that time.
I have a work around for it but would really like to know why this is not working properly.