Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have the following code to render the event Titles (the LinkTitle Column) in a custom web part:

<asp:Label ID="Title" runat="server" CssClass="titleStyle" Text='<%#Eval("LinkTitle")%>'></asp:Label><br />

It (the link to the Event List Item) shows up underlined but does not let the user edit.

Is there another way for me to specify it?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Please consider evolving your other questions rather than posting essentially the same question in different ways:

The LinkTitle and LinkTitleNoMenu fields are special "Computed" fields in SharePoint. They are rendered using the XSL transformation in SharePoint 2010. Please refer to this documentation on the topic: http://msdn.microsoft.com/en-us/library/ff604021.aspx

This is why I recommended that you leverage the XSL rendering system in the other questions to accomplish this task. Otherwise you would use code similar to what I provided in the "an-example-of-databinding-the-repeater-control" question.

share|improve this answer
    
Brian I apologize for the redundant Questions. Its just that I have been caught in this loop of trying different methods in getting it fixed.As of now I found this which gives the URL to edit (foreach (SPListItem item in oSPListItemCollection){ string itemURL =oSPWeb.Url + "/" + oSPList.Forms[PAGETYPE.PAGE_DISPLAYFORM].Url + "?ID=" + item.ID;) but now I'm stuck with trying to bind it to the repeater control. All this while I was just specifying Text ='<%# ...%>' directly on the ascx page. –  user7400 Mar 26 '12 at 19:33
    
Recommending you include this content in the question here with correct formatting applied to the code snippet. Then, determine exactly what you want to ask and ask it in the form of a question. Just indicating you "are stuck" kind of sounds like you are just asking the community to bail you out and do the work for you... –  Brian Mar 26 '12 at 20:23
    
...and in the other question, you had code that was hooked up to the OnItemDataBound event. What was wrong with that? Why do you feel need to bind to a simple property? If you want to use Eval, you need to bind your Repeater to a collection of objects that "wraps" the logic you would like to expose in a simple property value. Otherwise, use OnItemDataBound. Since it sounds like you are new to developing ASP.NET and SharePoint artifacts, just be aware of the potential performance issues if you are loading up too much data, but in your case, it doesn't sound like you are... –  Brian Mar 26 '12 at 20:26
    
Finally, I figured my way out. Here is what I came up with and it works just fine: void eventRepeater_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { ((HyperLink)e.Item.FindControl("Title")).NavigateUrl = SPContext.Current.Site.RootWeb.Url + "/Lists/Calendar/DispForm.aspx?ID=" + ((HiddenField)e.Item.FindControl("ItemID")).Value; } –  user7400 Mar 27 '12 at 20:21
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.