why a selectbutton in gridview?

D

Dan

Hi,

I made a gridview with ShowSelectButton="True", so the user can see and
click on that button, but all it does is to select that row. What's the
purpose of it?

Thanks
Dan
 
P

PeterKellner

Hi,

I made a gridview with ShowSelectButton="True", so the user can see and
click on that button, but all it does is to select that row. What's the
purpose of it?

Thanks
Dan

It's main purpose is it fires the rowcommand event and it sets the
selected properties:

GridView1.SelectedIndex;
GridView1.SelectedRow;
GridView1.SelectedValue;

These can be used to retrieve other controls data.
Peter Kellner
http://peterkellner.net
 
D

Dan

Thanks again, and because you seem to know everything about gridview, the
dates in my database are in short format, but they are shown in long format
(with the time) in the gridview. I didn't find how to dod that.
 
P

PeterKellner

Thanks again, and because you seem to know everything about gridview, the
dates in my database are in short format, but they are shown in long format
(with the time) in the gridview. I didn't find how to dod that.
Hi Dan,

I haven't posted for a while, so this seemed like a good one to write
up.

How To Set a Date Format In GridView Using ASP.NET 2.0
(Using HtmlEncode Property)
(AKA, the DataFormatString=”{0:M-dd-yyyy}” Problem)


http://peterkellner.net/?p=36

Peter Kellner
http://peterkellner.net
 
D

Dan

Peter,

Is it possible to set a date format in the code-behind page instead of the
aspx file?
I tried this:
ds = New DataSet()
d.Fill(ds)
z = ds.Tables(0).Rows(0).Item(2) '=position of the date field

but now, when i do:
z.
in VWD, i expect to find 'DataFormatString' ...

Thanks
Dan
 
P

PeterKellner

Peter,

Is it possible to set a date format in the code-behind page instead of the
aspx file?
I tried this:
ds = New DataSet()
d.Fill(ds)
z = ds.Tables(0).Rows(0).Item(2) '=position of the date field

but now, when i do:
z.
in VWD, i expect to find 'DataFormatString' ...

Thanks
Dan

not sure I understand what you are trying to do. could you post the
page you are trying with it's codebehind?
Peter Kellner
http://peterkellner.net
 
D

Dan

Peter, what i mean is:
instead of declaring everything in the aspx file, can everything be defined
programmatically in VB.net?
e.g. in the aspx file i did this for the date format:
<asp:BoundField DataField="dag"
DataFormatString="{0:dd-MM-yy}"
HtmlEncode="false" />

Is it possible to set the date format directly in vb.net (in the aspx.vb
file)?
I first fetched the right field with this:
ds = New DataSet()
d.Fill(ds)
z = ds.Tables(0).Rows(0).Item(2) '=position of the date field

but then how to apply the equivalent function "DateFormatString" to z?

More generally, i wonder whether there is a match between each tags in an
aspx. file and VB.net?
Another example:
how to define things like "Show Select Button" (in a gridview) in VB.net, or
"SelectCommand="..."

You see what i mean?
 
P

PeterKellner

Peter, what i mean is:
instead of declaring everything in the aspx file, can everything be defined
programmatically in VB.net?
e.g. in the aspx file i did this for the date format:
<asp:BoundField DataField="dag"
DataFormatString="{0:dd-MM-yy}"
HtmlEncode="false" />

Is it possible to set the date format directly in vb.net (in the aspx.vb
file)?
I first fetched the right field with this:
ds = New DataSet()
d.Fill(ds)
z = ds.Tables(0).Rows(0).Item(2) '=position of the date field

but then how to apply the equivalent function "DateFormatString" to z?

More generally, i wonder whether there is a match between each tags in an
aspx. file and VB.net?
Another example:
how to define things like "Show Select Button" (in a gridview) in VB.net, or
"SelectCommand="..."

You see what i mean?

I don't know how to change values in the asp:bound type fields, but
you can convert them to templates, then set them from the codebehind
by referencing the ID's of the controls directly.
Peter Kellner
http://peterkellner.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,165
Latest member
JavierBrak
Top