jquery - Passing data in ASP.NET -
i'm coding application jquery mobile , asp.net. have page code:
<asp:listview id="accountslistview" runat="server" datasourceid="xmldatasource1"> <layouttemplate> <div id="itemplaceholdercontainer" runat="server"> <ul data-role='listview' data-theme='c' data-inset='true'> <span id="itemplaceholder" runat="server" /> </ul> </div> </layouttemplate> <itemtemplate> <li> <a href='account_details.aspx'><h1><%#xpath("name")%></h1> <p><%#xpath("location")%></p> </a> </li> </itemtemplate> </asp:listview> <asp:xmldatasource id="xmldatasource1" runat="server" datafile="~/accountlist.xml"></asp:xmldatasource>
this creates list xml file of accounts. want have user select account , have page send node path page can display information individual account. i'm kind of stuck on how should go doing this.
a sample of xml file this:
<?xml version="1.0" encoding="iso-8859-1"?> <accountslist> <account> <name>bubba gump shrimp co.</name> <location>alabama</location> <account_num>1986</account_num> <contact_name>forrest gump</contact_name> <contact_phone>555-555-5555</contact_phone> </account> </accountslist>
just make onclick handler , have pass whatever data want in query parameter (or json data if want). may wish style div appropriately make normal tag.
// skip xml if want , use inline c# or vb <div id='blank-link' onclick='handleclick(" <%= myaccountid %> "'><%= myaccountname %></div> function handleclick( id ){ window.location.href = "myasppage.aspx?id=" + id; }
if don't want use query parameters, should asp.net url routing parse out values using accounts/id etc. http://msdn.microsoft.com/en-us/library/cc668201.aspx
Comments
Post a Comment