| | |
get data from detailview
Please support our ASP.NET advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
I have problem with detailview. My detail view like this:
ProductID: 1
ProductName: car
Price: 200
And when I click link button, it will appear "1"
This is the code behind:
But when I click link button, the text of label is "ProductID", not "1" like I want
Could you please help me? Thanks a lot!
ProductID: 1
ProductName: car
Price: 200
And when I click link button, it will appear "1"
This is the code behind:
ASP.NET Syntax (Toggle Plain Text)
Protected Sub LinkButton1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkButton1.Click Dim detail As DetailsView = DetailsView1 Dim rows As DataControlFieldCollection = detail.Fields Dim ProductID As DataControlField = rows.Item(1) Label1.Text = ProductID.ToString End Sub
Could you please help me? Thanks a lot!
Last edited by donaldunca; Mar 12th, 2009 at 4:54 am.
hi,
i have no exp in details view.may be it can help
try like this
i have no exp in details view.may be it can help
try like this
ASP.NET Syntax (Toggle Plain Text)
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px" OnItemCommand="DetailsView1_ItemCommand"> <Fields> <asp:TemplateField> <ItemTemplate> <asp:LinkButton ID="lnk" runat="server" CommandArgument='<%#Eval("Productid") %>' ></asp:LinkButton> </ItemTemplate> </asp:TemplateField> </Fields> </asp:DetailsView> protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e) { if (e.CommandName == "lnk") { string id = e.CommandArgument.ToString(); } }
If u r query is achieved,mark the thread as solved
Live and Let Live
Live and Let Live
hi,
sorry i fogot to add
sorry i fogot to add
ASP.NET Syntax (Toggle Plain Text)
<ItemTemplate> <asp:LinkButton ID="lnk" runat="server" CommandArgument='<%#Eval("Productid") %>' CommandName="lnk"></asp:LinkButton> </ItemTemplate>
If u r query is achieved,mark the thread as solved
Live and Let Live
Live and Let Live
![]() |
Other Threads in the ASP.NET Forum
- Previous Thread: DataList help!
- Next Thread: The remote server returned an error: (501) Not Implemented
Views: 572 | Replies: 2
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 3.5 ajax appliances application asp asp.net beginner box browser businesslogiclayer button c# cac checkbox child class compatible complex content contenttype control countryselector courier database datagrid datagridview datalist deployment development dgv dialog dropdown dropdownmenu dynamic dynamically edit editing embeddingactivexcontrol feedback fileuploader fill findcontrol flash flv folder form gridview gudi identity iis image javascript languages list maps menu mobile mssql nameisnotdeclared novell opera order problem profile ratings redirect refer registration relationaldatabases response.redirect rows search security select serializesmo.table sessionvariables silverlight smoobjects software sql ssl tracking treeview typeof validatedate validation vb vb.net vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment wizard xsl





