Click here to Skip to main content
15,885,767 members
Home / Discussions / C#
   

C#

 
Generalusing C# to implement Windows Service Pin
George_George3-Apr-08 22:32
George_George3-Apr-08 22:32 
GeneralRe: using C# to implement Windows Service Pin
Giorgi Dalakishvili3-Apr-08 22:34
mentorGiorgi Dalakishvili3-Apr-08 22:34 
GeneralRe: using C# to implement Windows Service Pin
George_George3-Apr-08 23:34
George_George3-Apr-08 23:34 
GeneralRe: using C# to implement Windows Service Pin
N a v a n e e t h3-Apr-08 23:36
N a v a n e e t h3-Apr-08 23:36 
GeneralRe: using C# to implement Windows Service Pin
George_George3-Apr-08 23:55
George_George3-Apr-08 23:55 
GeneralExtending Visual Studio 2005 Pin
Strannick3-Apr-08 22:24
Strannick3-Apr-08 22:24 
GeneralRe: Extending Visual Studio 2005 Pin
Pete O'Hanlon3-Apr-08 23:07
mvePete O'Hanlon3-Apr-08 23:07 
GeneralPersist data in design-time/runtime Pin
LuKas23_3-Apr-08 22:10
LuKas23_3-Apr-08 22:10 
Hi all,

I'm trying to extend GridView control to add in the Pager row a DropDownList with values to change the PageSize. The thing here is that, to make it general, I'd like to add the values to the DropDownList either in the Properties window at design time or in the code behind. I created a class to keep the values and, following instructions found in several forums, add the requested attributes.

Here is the code:
[DefaultProperty("Text")]
[ParseChildren(true), PersistChildren(false)]
        
public class MyGrid : GridView
{        
    //... Some variable declarations

    protected SizeItemCollection _PageSizeItems;
    [Category("Paging")]        
    [Editor(typeof(CollectionEditor), typeof(System.Drawing.Design.UITypeEditor))]
    [PersistenceMode(PersistenceMode.InnerDefaultProperty), MergableProperty(false)]
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
    [Description("Items list for the PageSize selector DropDownList")]
    public SizeItemCollection PageSizeItems
    {
        get
        {
            return (_PageSizeItems != null ? _PageSizeItems : new SizeItemCollection());
        }
    }
    protected override void InitializePager(GridViewRow row, int columnSpan, PagedDataSource pagedDataSource)
    {
        //Here I create the pager row and added the DropDownList with the values in PageSiZeItems
    }
	
    //... some more code ...
        
}

public class SizeItem : Component
{
    private int _size;
    public SizeItem() { }
    public SizeItem(int size)
    {
        _size = size;
    }
    public int Size
    {
        get { return _size; }
        set { _size = value; }
    }             
}

public class SizeItemCollection : CollectionBase
{
    //Here I implemented Add(), Insert(), Remove(), Contains(), IndexOf() and CopyTo()
    //for my SizeItem class
}


I manage to see the PageSizeItems modal form in design time to add the values, but I don't know why they are not stored properly. Same problem happens if I try to add the values in the code behind using the Add(SizeItem) method.

I'm pretty new to C# and .NET and would really appreciate some help on this. Please feel free to ask any other questions.

Thanks in advanced
Generalpop client in c#, connect with gmail.com Pin
dift3-Apr-08 21:50
dift3-Apr-08 21:50 
GeneralRe: pop client in c#, connect with gmail.com Pin
ChrisKo4-Apr-08 4:16
ChrisKo4-Apr-08 4:16 
QuestionData Grid Pin
Member 45007023-Apr-08 21:06
Member 45007023-Apr-08 21:06 
GeneralRe: Data Grid Pin
pmarfleet3-Apr-08 21:45
pmarfleet3-Apr-08 21:45 
GeneralRe: Data Grid Pin
Rick van Woudenberg4-Apr-08 3:44
Rick van Woudenberg4-Apr-08 3:44 
Questionhow can we get the call stack of target process Pin
sujithkumarsl3-Apr-08 20:50
sujithkumarsl3-Apr-08 20:50 
AnswerRe: how can we get the call stack of target process Pin
Pete O'Hanlon4-Apr-08 1:22
mvePete O'Hanlon4-Apr-08 1:22 
QuestionFTP Download trouble Pin
m1n1me3-Apr-08 20:24
m1n1me3-Apr-08 20:24 
GeneralRe: FTP Download trouble Pin
Sam Xavier24-Apr-08 21:11
Sam Xavier24-Apr-08 21:11 
QuestionUninitialized Object COM Exception Pin
bhavincpatel3-Apr-08 20:04
bhavincpatel3-Apr-08 20:04 
GeneralPerformance analysis Pin
sujithkumarsl3-Apr-08 19:54
sujithkumarsl3-Apr-08 19:54 
GeneralRe: Performance analysis Pin
Dave Kreskowiak4-Apr-08 5:39
mveDave Kreskowiak4-Apr-08 5:39 
Questioncreating Shortcut keys Pin
sumanshakya3-Apr-08 19:24
sumanshakya3-Apr-08 19:24 
GeneralRe: creating Shortcut keys Pin
rah_sin3-Apr-08 20:45
professionalrah_sin3-Apr-08 20:45 
GeneralRe: creating Shortcut keys Pin
N a v a n e e t h3-Apr-08 20:46
N a v a n e e t h3-Apr-08 20:46 
GeneralReportViewer: Printing only on odd pages Pin
Maddie from Dartford3-Apr-08 19:05
Maddie from Dartford3-Apr-08 19:05 
GeneralXbox controller Pin
meister_skypie3-Apr-08 19:03
meister_skypie3-Apr-08 19:03 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.