I have a grid that I want to use a slider in (as a custom pager).
The thing is, the pager used by the end-user is selectable at run time. Not a problem, I've got a couple of pagers that my users can use.
FYI I'm talking about a project that can be found here.
Using a technique one of the Grid support guys gave me, I intercept the Grid's standard Pager initialization and plug in my own, like this ...
Where 'SelectPager' is a routine that returns the relevant pager object.
Works a treat.
However, if my Pager control is a RadSlider things are a little different.
The slider is created and added to the PagerContentCell.Controls collection, but when the Grid is resized only the outer container for the Slider is there.
This is the HTML generated when the Grid is first displayed...
And this is what it looks like after the Grid is resized....
All I'm doing ATM to create my Slider is this ...
--
Stuart
The thing is, the pager used by the end-user is selectable at run time. Not a problem, I've got a couple of pagers that my users can use.
FYI I'm talking about a project that can be found here.
Using a technique one of the Grid support guys gave me, I intercept the Grid's standard Pager initialization and plug in my own, like this ...
void Grid_ItemEvent(object sender, GridItemEventArgs e) { |
if(e.EventInfo is GridInitializePagerItem) { |
e.Canceled = true; |
GridInitializePagerItem info = e.EventInfo as GridInitializePagerItem; |
(e.Item as GridPagerItem).PagerContentCell.Controls.Clear(); |
(e.Item as GridPagerItem).PagerContentCell.Controls.Add(SelectPager(info)); |
} |
} |
Works a treat.
However, if my Pager control is a RadSlider things are a little different.
The slider is created and added to the PagerContentCell.Controls collection, but when the Grid is resized only the outer container for the Slider is there.
This is the HTML generated when the Grid is first displayed...
<table> |
<tr class="GridPager_Default"> |
<td colspan="7"> |
<div id="RadSliderWrapper_RadGrid1_ctl01_ctl03_ctl01_ctl00" class="radslider RadSlider_Default horizontal" unselectable="on" style="width: 200px;"> |
<a title="Decrease" class="handle decrease" href="javascript:%20void(0);" id="RadSliderDecrease_RadGrid1_ctl01_ctl03_ctl01_ctl00" onmouseup="this.blur();" name="RadSliderDecrease_RadGrid1_ctl01_ctl03_ctl01_ctl00"><span>Decrease</span></a><span class="track" id="RadSliderTrack_RadGrid1_ctl01_ctl03_ctl01_ctl00" unselectable="on" style="width: 178px; height: 2px;"></span> |
<div class="selectedregion" id="RadSliderSelected_RadGrid1_ctl01_ctl03_ctl01_ctl00" style="width: 4.5px;"> |
<span class="track" id="RadSliderTrack_RadGrid1_ctl01_ctl03_ctl01_ctl00" unselectable="on" style="width: 178px; height: 2px;"><!-- --></span> |
</div><span class="track" id="RadSliderTrack_RadGrid1_ctl01_ctl03_ctl01_ctl00" unselectable="on" style="width: 178px; height: 2px;"><a title="Drag" class="draghandle" href="javascript:%20void(0);" id="RadSliderDrag_RadGrid1_ctl01_ctl03_ctl01_ctl00" onmouseup="this.blur();" style="left: 0px;" name="RadSliderDrag_RadGrid1_ctl01_ctl03_ctl01_ctl00"><span>Drag</span></a></span><a title="Increase" class="handle increase" href="javascript:%20void(0);" id="RadSliderIncrease_RadGrid1_ctl01_ctl03_ctl01_ctl00" onmouseup="this.blur();" name="RadSliderIncrease_RadGrid1_ctl01_ctl03_ctl01_ctl00"><span>Increase</span></a> |
</div> |
<div style="width: 200px; display: none;" class="radslider RadSlider_Default horizontal" id="RadGrid1_ctl01_ctl03_ctl01_ctl00"> |
<input type="hidden" name="RadGrid1_ctl01_ctl03_ctl01_ctl00_ClientState" id="RadGrid1_ctl01_ctl03_ctl01_ctl00_ClientState" value="{"> |
</div> |
</td> |
</tr> |
</table> |
And this is what it looks like after the Grid is resized....
<table> |
<tr class="GridPager_Default"> |
<td colspan="7"> |
<div style="width: 200px;" class="radslider RadSlider_Default horizontal" id="RadGrid1_ctl01_ctl03_ctl01_ctl00"> |
<input type="hidden" name="RadGrid1_ctl01_ctl03_ctl01_ctl00_ClientState" id="RadGrid1_ctl01_ctl03_ctl01_ctl00_ClientState"> |
</div> |
</td> |
</tr> |
</table> |
All I'm doing ATM to create my Slider is this ...
public class PageSlider : RadSlider { |
public PageSlider() |
: base() { |
MinimumValue = 1; |
MaximumValue = 100; |
Length = 200; |
AutoPostBack = true; |
} |
} |
--
Stuart