在ASP.Net中自定义向导控件的外观,并发现了如何使用SideBarTemplate禁用侧边栏按钮并捕获OnItemDataBound事件。非常简单。我现在想要做的是修改渲染的LinkButton的文本,在当前步骤中为步骤名称加上“>>”之类的前缀。在ASP.Net向导中设置LinkButton标题向导栏模板
所以,对于SideBarList我ItemDataBound事件处理程序中,我有以下代码:
Dim stepCurrent As WizardStep = e.Item.DataItem
Dim linkCurrent As LinkButton = e.Item.FindControl("SideBarButton")
If Not stepCurrent Is Nothing Then
Trace.Write("SideBar", "Current Step = " & stepCurrent.Wizard.ActiveStep.Name)
Trace.Write("Sidebar", "Link Button = " & linkCurrent.Text)
linkCurrent.Enabled = False
If stepCurrent.Wizard.ActiveStepIndex = e.Item.ItemIndex Then
linkCurrent.Style.Add(HtmlTextWriterStyle.Color, "#000000")
linkCurrent.Style.Add(HtmlTextWriterStyle.FontWeight, "bold")
linkCurrent.Text.Insert(0, ">> ")
End If
End If
不过,我觉得是跟踪输出显示为lunkbutton文本空字符串,但风格改变工作。
我想在错误的地方设置文本?
感谢