Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > how to get the value of a field in a detailsview?

Reply
Thread Tools

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

 
 
Chris
Guest
Posts: n/a
 
      07-28-2007
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


 
Reply With Quote
 
 
 
 
chenhong
Guest
Posts: n/a
 
      07-29-2007
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" <> 写入消息新闻: ...
>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
>



 
Reply With Quote
 
 
 
 
Chris
Guest
Posts: n/a
 
      07-29-2007
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

"chenhong" <> schreef in bericht
news:Oj2$...
> 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" <>
> 写入消息新闻: ...
>>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
>>

>
>



 
Reply With Quote
 
chenhong
Guest
Posts: n/a
 
      07-29-2007
this question is the same as your another question,
see the reply there.


"Chris" <> 写入消息新闻: ...
> 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
>
> "chenhong" <> schreef in bericht
> news:Oj2$...
>> 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" <> 写入消息新闻: ...
>>>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
>>>

>>
>>

>
>



 
Reply With Quote
 
Chris
Guest
Posts: n/a
 
      07-29-2007
This has been solved.
Thanks for your help.



"chenhong" <> schreef in bericht
news:%...
> this question is the same as your another question,
> see the reply there.
>
>
> "Chris" <>
> 写入消息新闻: ...
>> 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
>>
>> "chenhong" <> schreef in bericht
>> news:Oj2$...
>>> 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" <>
>>> 写入消息新闻: ...
>>>>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
>>>>
>>>
>>>

>>
>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
javascript validation for a not required field, field is onlyrequired if another field has a value jr Javascript 3 07-08-2010 10:33 AM
Copy File Field Value to Dynamic File Field Value VUNETdotUS Javascript 25 11-10-2007 10:36 AM
1.Enter space bar for field names and save the field.The field shoud not get saved and an alert should be there as"Space bars are not allowed" Sound Javascript 2 09-28-2006 02:43 PM
Validating a field based on value of another field Emmanuel ASP .Net 1 11-22-2005 12:35 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57