Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 30th, 2006, 04:02 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to change values in asp:bound field

Hi,

This is the content of an aspx file: ('dat' is a date field in a table)
<asp:BoundField DataField="dat"
DataFormatString="{0:dd-MM-yy}"
HtmlEncode="false" />
<asp:CommandField ShowEditButton="True"/>

What i want to know is how to set the property 'DataFormatString' directly in VB.net and how to program 'ShowEditButton="True"' (in the code-behind page aspx.vb) instead of like here?

I could already do this:
Dim obj As DataControlField
obj = GridView1.Columns.Item(0)
response.write(obj)

This gives "CommandField"
(Item(1) gives "BoundField")

But now, i'm stuck ...

Thanks

  #2 (permalink)  
Old May 30th, 2006, 10:55 PM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Dim obj As BoundField
obj = GridView1.Columns.Item(1)
obj.DataFormatString = "{0:d}"
obj.HtmlEncode = False

Dim obj2 As CommandField
obj2 = GridView1.Columns.Item(0)
obj2.ShowEditButton = False

OR
You can create the column and add it

Dim obj2 As New CommandField
obj2.ShowEditButton = True
GridView1.Columns.Insert(0, obj2)



  #3 (permalink)  
Old May 31st, 2006, 05:54 AM
Friend of Wrox
 
Join Date: Apr 2006
Location: , , .
Posts: 160
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply.

Maybe one more question:
why can't i create a form in the code-behind page?
I know there can be only one, but even when i remove the form from the aspx page and doing this in aspx.vb page:
dim f as ...

no form to see in the dropdownlist
Is there a particular reason for this?
Thanks

  #4 (permalink)  
Old May 31st, 2006, 08:45 AM
Friend of Wrox
Points: 4,332, Level: 27
Points: 4,332, Level: 27 Points: 4,332, Level: 27 Points: 4,332, Level: 27
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2003
Location: , NJ, USA.
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Dim f As New HtmlGenericControl("Form") ????

 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating Bound Controls Values automatically Borhani Excel VBA 0 January 20th, 2008 12:48 PM
get the values of form field values crmpicco Perl 2 March 16th, 2007 10:57 AM
ASP.NET 2 Data Bound CommandArgument rodmcleay General .NET 4 August 18th, 2006 05:35 AM
how to change values in asp:bound field hertendreef VS.NET 2002/2003 1 May 29th, 2006 06:45 AM
Unable to change DB values using ASP dghughes42 Classic ASP Databases 2 January 31st, 2004 02:04 PM



All times are GMT -4. The time now is 08:03 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.