asp.net - add an initial line-through text-decoration on a label in a asp listview -
asp.net - add an initial line-through text-decoration on a label in a asp listview -
my goal display list of tasks checkboxes. checking checkbox task update display of task line-through text decoration appear. everythign working great, except can't figure out how show list of tasks line-through if completed, or normal if task not completed. here's code excerpts:
<asp:listview .../> ... <itemtemplate> <asp:hiddenfield id="taskcompleted" runat="server" value='<%#bind("taskcompleted")%>'/ <asp:checkbox id="completedcheckbox" runat="server" autopostback="true" oncheckedchanged="completedcheckboxchange" checked='<%#iif(eval("taskcompleted"), "true", "false")%>' /> <asp:label id="tasklabel" text='<%#eval("taskdesc")%>' runat="server" /> </itemtemplate> ... </asp:listview> then code behind (minus database stuff works fine):
protected sub completedcheckboxchange( byval sender object, byval e eventargs ) dim completed checkbox = trycast( sender, checkbox ) dim annualprogramtasksid hiddenfield = trycast(completed.parent.findcontrol("annualprogramtasksid"), hiddenfield) dim tasklabel label = trycast(completed.parent.findcontrol("tasklabel"), label) if completed.checked 'update task displayed, give line-through tasklabel.style("text-decoration") = "line-through" else 'update task displayed, give line-through tasklabel.style("text-decoration") = "none" end if end sub so works great, when click on checkbox lable gets line-through or none based on checkbox. problem when load page, can't figure out how update style of tasklabel show line-through or not. i've tried various routes, nil panning out. ideas?
this how have done whay trying to. try
<asp:label id="tasklabel" text='<%#eval("taskdesc")%>' runat="server" ondatabinding="tasklabel_databinding" /> and
protected sub tasklabel_databinding( byval sender object, byval e eventargs ) dim completed checkbox = trycast(directcast( sender, control).parent.findcontrol("completedcheckbox"), checkbox) completedcheckboxchange(completed, eventargs.empty) end sub asp.net vb.net listview
Comments
Post a Comment