I am unsure which asp.net control to use. I've tried / thought about with no avail.
Repeater / ListBox (doesn't allow for multiple lines)
Repeater / Div (No click unless I use JavaScript postback)
I have a list of Messages in codebehind that I would like to attach to some UI control that could display them (spanning multiple lines per item), with good styling.
I need the clickable functionality of a selected item change in a ListBox. But I need the ability to space out each Line item to span multiple lines and possibly contain graphics.
A good visual example would be the inbox view of Microsoft Outlook. Each message consists of the Email-Address, timestamp, etc spaced out and styled nicely. How do I accomplish this with asp.net? :)
You can put a repeater inside another repeater...
That will help you nest multiple elements per row
I typically use KnockoutJS for these types of requirements though since it offers great data bound templates
Related
I would like to be able to add some custom text within the built in pager area of Telerik's Grid component for Blazor. It would also be nice to be able to change the predefined text, but the image below shows what I would like to accomplish.
I have found several resources showing how to do this using other Telerik products, but I haven't been able to find anything for Blazor. Here is an example I found for Kendo UI for Angular Changing the text of the paging area in the grid and another one I found but for ASP.NET AJAX Change label text of pager item. However, these did not help me much.
Does anyone know of a way I can accomplish this?
If you want custom markup within the Pager, they have a logged item for that - https://feedback.telerik.com/blazor/1557339-pager-template
If you just want to update the label/s, you should be able to do this through the localization strings - https://docs.telerik.com/blazor-ui/globalization/localization
The topic says it all essentially. I need to have my live tiles display various types of data, such as lists, charts, etc, and have them auto update by pulling data from web service. I need to know how can I host listview or a chart control inside live tile control.
My current setup is a Telerik RadTileList that I add dynamically to in code behind my custom class that inherits from Telerik LiveTile, I specify my webservice that for example can get back a list object with a couple of fields.
I know I can display them directly in my LiveTile's ClientTemplate referencing them with #= data.FieldName #, but I want the data to be displayed by an imbeded Telerik ListView control that I can hopefully can insert somehow inside my livetile and have the results of the webservice bind to it.
If I'm over-thinking it, or if the architecture can be improved to achieve the same I am open for suggestions as well as long as I can achieve the end result described above.
Any suggestions would be appreciated.
I don't think you can do this. Live tiles only take HTML: http://www.telerik.com/help/aspnet-ajax/tilelist-server-side-tile-object.html. Here is what it says for the ClientTemplate: Gets/sets the HTML template that will be instantiated in the tile after live data request..
I think that you could get the data, bind it to a hidden listview or chart and move the bound listview/chart in the DOM to inside the tile, via the events and API it has:
http://www.telerik.com/help/aspnet-ajax/tilelist-tiles-client-side-events-livetile-onclienttemplatedatabound.html
http://www.telerik.com/help/aspnet-ajax/tilelist-client-side-tile-api.html
but I am not sure if any other functionality of the controls you move will work after that, since you will only be moving their HTML.
You can generate lists with JavaScript if that will work for you and use set_html()...
How can I get my CheckBoxList to have three possible states ? More precisely, is there a way to have three possible states for each checkbox : checked, unchecked, undefined (in most GUIs this is represented as a full square).
Alternatively, do you recommend another control that would meet these needs ?
UPDATE : Ok, given that HTML does not support tri-state checkboxes, I'm looking for a way to 'CSS' (color fill, highlight, etc...) the checkboxes of the items that are in that 'undefined' state from my server point of view.
Not all GUIs represent undefined as a full square. That's why it's going to be clearer to use one of the following:
1. Radio boxes
2. Dropdown
3. ListBox
Any asp.net control you use will ultimately need to be rendered as an html checkbox, which can only be checked or unchecked. You could use a data- attribute to keep track of extra state behind the scenes, but that wouldn't be reflected in the UI.
I suppose you could also implement a client-side solution using JavaScript and CSS as well.
You could just extend or derive from the CheckBoxList and create your own custom control from it.
Here is an example of this.
Custom CheckBoxList
I have decided to use CheckBoxList anyway, since I need two states accessible by the user, and a third one not accessible by the user but to display inconsistencies.
The way I have solved this is through Javascript + CSS. Some bits of ideas here: http://css-tricks.com/indeterminate-checkboxes/
I've been trying to iterate over a placeholder in sitecore. Essentially, there control that needs to be repeated by the page for a collection of elements (say a tab). I've only gotten the placeholder to render once. The following tabs don't have content inserted into them.
The code for something like what I'm trying to do is:
<asp:Repeater ID="rptTabs" runat="server">
<sc:Placeholder ID="plSocialSharing" runat="server" Key="Social"/>
<sc:Placeholder ID="plTab" runat="server" Key="content"/>
</asp:Repeater>
Should something like what I'm doing work? If it doesn't, do I need to user another sitecore control (something more dynamic?). Should I instead be using user controls I place there, or should I stick with the sitecore framework approach?
Since each of your tabs will contain the same rendering the I would not bother with placeholders. I think you will be adding more complexity than is required.
Assuming you are going to be using the jQuery UI Tab plugin then I would use the same technique you used in the previous question you asked, i.e. render out the content of the div tabs in the repeater, and you will need another repeater to create the ul list of the actual tabs.
Assuming you have a tree structure like:
- Social Sharing
-- Facebook
-- Twitter
-- Email
You could now Social Sharing use as the datasource of your Repeater and still allow the content of the tabs to be editable if you use Sitecore controls.
If you wanted something much more dynamic, like different rendering for each of the tabs, for example one with rich text, one with 2 column, one with table etc, then again there are a couple of ways of achieving this. One way would be to use standard <asp:PlaceHolder> in your repeater and add the rendering in this from your codebehind on ItemDataBound event.
Another option would be to add a bunch of different renderings into the placeholder in the page editor and set the datasource of each to content item. It will be difficult to use jQueryUI Tabs with this though since you would want markup like this in each control to make them self contained:
<div class="tab-title">Tab Title</div>
<div class="tab-content">Put whatever content you want in here</div>
As long as each rendering followed this structure then it would be easy to add several of these to the page and they would still be editable in the Page Editor, albeit listed one after another (not in tab format) in Editing mode. You would need to roll your own tab plugin, but it could be something as simple as:
Only in Preview or Normal mode
Get all .tab-title elements
Create a ul list and prepend to the tab container
Now call jQuery UI Tabs on the element
Hopefully given you some options at least, I can expand on any of these if it something you need but will have to get some code samples together.
I have a section on my website where I plan to add a lot of text-based content, and rather than display this all at once it would be nice if I could add paging on just these pages. If possible, I would like to put all of my content within one content item and have the paging work automatically, building a URL along the lines of http://example.org/articles/title?page=2 or similar.
I've stumbled across an article that mentions paging with Sitecore items and this seems rather close to what I require, although mine requires pagination on a single content item, rather than multiple items. Can someone help me adapt this article towards my needs (if it's on the right track of where I should be looking)?
Is it possible to do this with a Sitecore content item?
http://briancaos.wordpress.com/2010/09/10/create-a-google-style-paging-component-in-c/
I think you'd either want to create your own WebControl and define a custom Render() method that reads the query string to write out the correct information, or you could even do it all in a Sublayout (a user control ASCX file). I've done this before by adding in a custom tag in the Rich text editor via Sitecore (I think I used <hr class="page-break" />) then in my ASCX I'd look for that HTML tag and split the content into chunks from that. I think my solution also used jQuery for some of it but you could probably do it with C# too.
Edit:
You'd want to split the tasks up and have the "paged" content as well as a list of pages (like the article you referenced) so you can easily generate the page buttons. Both of these could be done in two separate repeaters.
You can split the text from a single field into the different pages using approach described here: Split html string to page. All you need to do after that - read the query string and display appropriate block.
If I understand you correctly you have an Item in Sitecore that has x number of text fields and you only want a subset of those displayed depending on input in the querystring ?
In it's simplest form you want a sublayout that handles that.
Basically I'd imagine you having fields called Text1, Text2, text3 etc.
This .ascx could then retrieve the data for fields the fields you'd want using the control and adding them.
Then you could use the code from the article to generate the paging links.
This should be simple enough, but I'd say it would be a better idea to have an item in sitecore and use it's children as the data you want viewed and paged.
It's nicer because if you start out with 5 "page" fields and suddenly want 10, your item will keep on growing, where children can be added without bloating the parent page. Plus the user could then order the children how he sees fit.
I hope this helps a bit.