| | |
get data from detailview
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
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
| Thread Tools | Search this Thread |
Tag cloud for ASP.NET
.net 2.0 ajax alltypeofvideos anathor appliances application asp asp.net bc30451 beginner box browser button c# cac checkbox commonfunctions complex control dataaccesslayer database datagridview datalist deployment development dgv dialog dropdownlist dynamic dynamically edit editing embeddingactivexcontrol expose feedback fileuploader fill findcontrol flash form formatdecimal formview google gridview gudi iis image javascript list listbox login microsoft mobile mouse mssql news novell numerical opera panelmasterpagebuttoncontrols parent project radio redirect registration relationaldatabases reportemail response.redirect richtextbox rows schoolproject search security select sessionvariables silverlight smoobjects software sql-server sqlserver2005 ssl suse textbox tracking treeview unauthorized validatedate validation vb.net videos vista visualstudio web webapplications webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





