471,311 Members | 1,835 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,311 software developers and data experts.

datalist, revisited

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")).ToShortDateSt ring %>
<%# 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...
Nov 19 '05 #1
0 852

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by pete K | last post: by
10 posts views Thread by Bharat | last post: by
4 posts views Thread by Patrick.O.Ige | last post: by
6 posts views Thread by Paul | last post: by
3 posts views Thread by Mirek Endys | last post: by
1 post views Thread by AJ | last post: by
3 posts views Thread by Crazy Cat | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.