Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

how to get the value of a field in a detailsview?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Chris - 28 Jul 2007 16:02 GMT
I need the value of a field of a detailsview in DataBound event.
i can find the fieldname with this:
Dim a As DataControlField
a = DetailsView1.Fields(0)

But how to get the value of that field?
i tried a lot of things without succes:
Protected Sub DetailsView1_DataBound(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DetailsView1.DataBound
dim enqna as DetailsViewRow
enqna = DetailsView1.DataItem

or

dim enqna As DataColumn
enqna= DetailsView1.DataItem
....
or
Dim va As String
va = DetailsView1.Controls.Item(1).ToString

Thanks for help
Chris
chenhong - 29 Jul 2007 01:25 GMT
you could get the value of the field by get the value of the corresponding
label control value of the field.
the lable load event should do the trick.

"Chris" <gddfd@er.df> дÈëÏûÏ¢ÐÂÎÅ:OIDzIhS0HHA.1208@TK2MSFTNGP03.phx.gbl...
>I need the value of a field of a detailsview in DataBound event.
> i can find the fieldname with this:
[quoted text clipped - 19 lines]
> Thanks for help
> Chris
Chris - 29 Jul 2007 09:17 GMT
Hi, thanks for replying.
I ommit to mention that the fields are templatefields, like this:
<asp:TemplateField SortExpression="enqna">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("enqna")
%>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1a" runat="server" Text='<%# Bind("enqna")
%>'></asp:Label>
</ItemTemplate>
<ItemStyle Font-Bold="True" Font-Size="Larger" HorizontalAlign=Center />
</asp:TemplateField>

So there is no 'label1a' load event (the value i'm interesting it).
Thanks

> you could get the value of the field by get the value of the corresponding
> label control value of the field.
[quoted text clipped - 25 lines]
>> Thanks for help
>> Chris
chenhong - 29 Jul 2007 14:48 GMT
this question is the same as your another question,
see the reply there.

"Chris" <gddfd@er.df> дÈëÏûÏ¢ÐÂÎÅ:ubBG3jb0HHA.4568@TK2MSFTNGP03.phx.gbl...
> Hi, thanks for replying.
> I ommit to mention that the fields are templatefields, like this:
[quoted text clipped - 41 lines]
>>> Thanks for help
>>> Chris
Chris - 29 Jul 2007 21:34 GMT
This has been solved.
Thanks for your help.

> this question is the same as your another question,
> see the reply there.
[quoted text clipped - 47 lines]
>>>> Thanks for help
>>>> Chris

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.