datalist, revisited

R

rbutch

i should have included the code in the first post.
sorry.
i've got this working but it returns the 'index' property whereas i'd like the value of what's in the property.i'll include the minimalist of code here

<asp:datalist id="Datalist1" OnItemCommand="getSelected">

<SelectedItemTemplate>
<asp:HyperLink ID="ot_job_id" Runat="server" />
</SelectedItemTemplate>

<ItemTemplate>
<asp:LinkButton Runat="server" CommandName="select">
<%# Container.DataItem("ot_job_id")%>
</asp:LinkButton>
</ItemTemplate>

<SelectedItemTemplate>
<%# Databinder.Eval(Container.DataItem,"ot_job_id") %>
<%# Convert.ToDateTime(Databinder.Eval (Container.DataItem,"balance_date")).ToShortDateString %>
<%# Databinder.Eval(Container.DataItem,"bid_area") %>
<%# Databinder.Eval(Container.DataItem,"sched_start") %>
<%# Databinder.Eval(Container.DataItem,"sched_end") %>
</SelectedItemTemplate>
</asp:datalist>

thats the datalist, and i think that part is fine.
here's where i believe i get stuck, im only pulling the index and i need to get to the
actual value of the selection.

<script runat="server">
Sub getSelected(s as object, e as DataListCommandEventArgs )
dim mychoice as string
DataList1.SelectedIndex = e.Item.ItemIndex

mychoice = Datalist1.SelectedIndex.toString (i know im just pulling an index here, i
just wanted to see that i'm reaching anything)

lblMsg.text = mychoice
End Sub
</script>


thanks again to anyone who can shed some light on this
rik



original post:

does anyone know of a good place to go to get some ideas on datalists?
im building a web app, in asp.net (vb.net) and displaying data in a data list.

i want to be able to select any one of the first column items with a "onclick" and store the 'literal' in a variable (either session or global)
at this point i'm not picky at all.

ive tried using the OnItemCommand="someProc" in the code behind w/out much luck

any help is appreciated. ive been looking on the web and in books for days and found all sorts of variations, from making that column a 'link' , to making it an <asp:button>

thanks again as usual.
great great forum here
rik


**********************************************************************
Sent via Fuzzy Software @ http://www.fuzzysoftware.com/
Comprehensive, categorised, searchable collection of links to ASP & ASP.NET resources...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,586
Members
45,090
Latest member
ActivlifeKetoDiet

Latest Threads

Top