|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SortCommand and custom headers - why won't they play nice?I am programmatically adding columns to it and hooking it up to a dataset. In my ItemDataBound(), I am adding some text and background coloring to the Items, and to the Header as well. This all works great! Now, however, I want to be able to sort the grid by clicking on the column headers. I set the datagrid.allowsorting = true, wired up my SortCommand(), and it basically works, EXCEPT it overwrites the formatting and extra text I put in the header cells. Is there some way I need to manually put in a hyperlink with a command in the header? Can I make a HeaderTemplate in the aspx page that does that, and still set the text and coloration manually? Thanks for the help! - Nevyn I did the same some time ago, however with the differecne that I used
ItemCreated to change the backcolor of the sorted cells. I never had any problems with that. You might want to try it in ItemCreated. -- Show quoteHide quoteSonu Kapoor - [MCP] ASP.NET Moderator WebSite: http://www.Kapoorsolutions.com Blog: http://www.Kapoorsolutions.com/blog/ ASP.NET News: http://www.Kapoorsolutions.com/reblogger/ "Nevyn Twyll" wrote: > I have a datagrid on my webform. > I am programmatically adding columns to it and hooking it up to a dataset. > In my ItemDataBound(), I am adding some text and background coloring to the > Items, and to the Header as well. > > This all works great! > > Now, however, I want to be able to sort the grid by clicking on the column > headers. > > I set the datagrid.allowsorting = true, wired up my SortCommand(), and it > basically works, EXCEPT it overwrites the formatting and extra text I put in > the header cells. > Is there some way I need to manually put in a hyperlink with a command in > the header? Can I make a HeaderTemplate in the aspx page that does that, > and still set the text and coloration manually? > > Thanks for the help! > > - Nevyn > > > Well, we also need to dynamically set the header text/etc., so I don't know
that ItemCreated would work - plus, it's still overwriting it, and I would think that DataBound() happens later than Created().... Show quoteHide quote "Sonu Kapoor" <SonuKap***@discussions.microsoft.com> wrote in message news:C33547BE-4DAB-4E2E-B60F-25FB791D2F36@microsoft.com... >I did the same some time ago, however with the differecne that I used > ItemCreated to change the backcolor of the sorted cells. I never had any > problems with that. You might want to try it in ItemCreated. > > -- > Sonu Kapoor - [MCP] > ASP.NET Moderator > WebSite: http://www.Kapoorsolutions.com > Blog: http://www.Kapoorsolutions.com/blog/ > ASP.NET News: http://www.Kapoorsolutions.com/reblogger/ > > > "Nevyn Twyll" wrote: > >> I have a datagrid on my webform. >> I am programmatically adding columns to it and hooking it up to a >> dataset. >> In my ItemDataBound(), I am adding some text and background coloring to >> the >> Items, and to the Header as well. >> >> This all works great! >> >> Now, however, I want to be able to sort the grid by clicking on the >> column >> headers. >> >> I set the datagrid.allowsorting = true, wired up my SortCommand(), and it >> basically works, EXCEPT it overwrites the formatting and extra text I put >> in >> the header cells. >> Is there some way I need to manually put in a hyperlink with a command in >> the header? Can I make a HeaderTemplate in the aspx page that does that, >> and still set the text and coloration manually? >> >> Thanks for the help! >> >> - Nevyn >> >> >> Can you show me the ItemDataBound code and the SortCommand where it
overwrites the header text? -- Show quoteHide quoteSonu Kapoor - [MCP] ASP.NET Moderator WebSite: http://www.Kapoorsolutions.com Blog: http://www.Kapoorsolutions.com/blog/ ASP.NET News: http://www.Kapoorsolutions.com/reblogger/ "Nevyn Twyll" wrote: > Well, we also need to dynamically set the header text/etc., so I don't know > that ItemCreated would work - plus, it's still overwriting it, and I would > think that DataBound() happens later than Created().... > > "Sonu Kapoor" <SonuKap***@discussions.microsoft.com> wrote in message > news:C33547BE-4DAB-4E2E-B60F-25FB791D2F36@microsoft.com... > >I did the same some time ago, however with the differecne that I used > > ItemCreated to change the backcolor of the sorted cells. I never had any > > problems with that. You might want to try it in ItemCreated. > > > > -- > > Sonu Kapoor - [MCP] > > ASP.NET Moderator > > WebSite: http://www.Kapoorsolutions.com > > Blog: http://www.Kapoorsolutions.com/blog/ > > ASP.NET News: http://www.Kapoorsolutions.com/reblogger/ > > > > > > "Nevyn Twyll" wrote: > > > >> I have a datagrid on my webform. > >> I am programmatically adding columns to it and hooking it up to a > >> dataset. > >> In my ItemDataBound(), I am adding some text and background coloring to > >> the > >> Items, and to the Header as well. > >> > >> This all works great! > >> > >> Now, however, I want to be able to sort the grid by clicking on the > >> column > >> headers. > >> > >> I set the datagrid.allowsorting = true, wired up my SortCommand(), and it > >> basically works, EXCEPT it overwrites the formatting and extra text I put > >> in > >> the header cells. > >> Is there some way I need to manually put in a hyperlink with a command in > >> the header? Can I make a HeaderTemplate in the aspx page that does that, > >> and still set the text and coloration manually? > >> > >> Thanks for the help! > >> > >> - Nevyn > >> > >> > >> > > >
Custom Controls & Javascript
DataGrid with edititemtemplate What happened to Alignment property? RadioButton in 2 GroupNames? Another basic question: How to call and show one Web Form from another Web Form? ASP.net datagrid with more than 1 datasource Odd Dropdownlist problem ListBox not firing SelectedIndexChanged (AutoPostBack=True) Panel limitations? Event Handling Question |
|||||||||||||||||||||||