List Info

Thread: Re: gridview question




Re: gridview question
user name
2007-01-29 16:28:46
Hi
Thanks for your reply. I know how to parse datetime as
dd-mm-yyyy in 
c#, I wanted to know how to do that in gridview control,
when I am 
updating a date using edit button.

the gridview uses the following :


<asp:SqlDataSource ID="SqlDataSource2"
runat="server" 
ConnectionString="<%$ ConnectionStrings:String1
%>"
            SelectCommand="SELECT [appointmentDate],  
[appointmentCustomerId] FROM [appointments] WHERE 
([appointmentCustomerId] = appointmentCustomerId)" 

UpdateCommand="UPDATE appointments SET appointmentDate
= 
appointmentDate WHERE (appointmentCustomerId = 
appointmentCustomerId)">
            <SelectParameters>
            <asp:FormParameter
FormField="DetailsCustId" 
Name="appointmentCustomerId"
Type="Int32" />
            </SelectParameters>
            <UpdateParameters>
                <asp:Parameter
Name="appointmentDate" />
            </UpdateParameters>
        </asp:SqlDataSource>

--- In AspNetAnyQuestionIsOk@yahoogroups.com, "Dean
Fiala" 
<dfiala...> wrote:
>
> Remember the date string is just a display version of a
DateTime 
value. Once
> you get into a DateTime structure you can display it
any way you 
want.
> 
> You can use the Parse method
> http://msdn2.microsoft.com/en-us/library/syst
em.datetime.parse.aspx,
> 
> to load the structure.  The simplest overload of the
method uses he 
current
> culture of the application to parse the string.  If you
want to use 
a
> different culture or date style you need to use one of
the other
> constructors and supply the culture and/or style to
use.
> 
> and here's some more on parsing....
> http://msdn2.microsoft.com/en-us/library/2h3syy57.aspx

> 
> Once you've created the DateTime structure, you can
display the 
value using
> it's ToString() method
> 
> DateTime EnteredDate = DateTime.Parse(EnteredString);
> string FormattedDate =
EnteredDate.ToString("MM-dd-yyyy"); //case 
matters,
> mm is minutes
> 
> On 1/28/07, OwaiZ <owaiz_vaiyani...>
wrote:
> >
> >   hi
> > any know how to convert entered date string from
dd-mm-yyyy to mm-
dd-
> > yyyy when using update in gridview
> > thanks
> >
> >  
> >
> 
> 
> 
> -- 
> Dean Fiala
> Very Practical Software, Inc
> Now with Blogging...
> http://www.vpsw.com/blog
baby
> Microsoft MVP
> 
> 
> [Non-text portions of this message have been removed]
>




 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:AspNetAnyQuestionIsOk-digest@yahoogroups.com 
   
mailto:AspNetAnyQuestionIsOk-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

Re: Re: gridview question
user name
2007-01-29 18:24:49
In your update command you need to format the parameter
value

DateTime EnteredDate =
DateTime.Parse(e.NewValues["appointmentDate"]);


SqlDataSource2.UpdateParameters["appointmentDate"]
.DefaultValue =
EnteredDate.ToString("MM-dd-yyyy");

On 1/29/07, OwaiZ <owaiz_vaiyanihotmail.com> wrote:
>
>   Hi
> Thanks for your reply. I know how to parse datetime as
dd-mm-yyyy in
> c#, I wanted to know how to do that in gridview
control, when I am
> updating a date using edit button.
>
> the gridview uses the following :
>
> <asp:SqlDataSource ID="SqlDataSource2"
runat="server"
> ConnectionString="<%$ ConnectionStrings:String1
%>"
> SelectCommand="SELECT [appointmentDate],
> [appointmentCustomerId] FROM [appointments] WHERE
> ([appointmentCustomerId] = appointmentCustomerId)"
>
> UpdateCommand="UPDATE appointments SET
appointmentDate =
> appointmentDate WHERE (appointmentCustomerId =
> appointmentCustomerId)">
> <SelectParameters>
> <asp:FormParameter
FormField="DetailsCustId"
> Name="appointmentCustomerId"
Type="Int32" />
> </SelectParameters>
> <UpdateParameters>
> <asp:Parameter Name="appointmentDate"
/>
> </UpdateParameters>
> </asp:SqlDataSource>
>
> --- In
AspNetAnyQuestionIsOk@yahoogroups.com<AspNetAnyQuestionIs
Ok%40yahoogroups.com>,
> "Dean Fiala"
> <dfiala...> wrote:
> >
> > Remember the date string is just a display version
of a DateTime
> value. Once
> > you get into a DateTime structure you can display
it any way you
> want.
> >
> > You can use the Parse method
> > http://msdn2.microsoft.com/en-us/library/syst
em.datetime.parse.aspx,
> >
> > to load the structure. The simplest overload of
the method uses he
> current
> > culture of the application to parse the string. If
you want to use
> a
> > different culture or date style you need to use
one of the other
> > constructors and supply the culture and/or style
to use.
> >
> > and here's some more on parsing....
> > http://msdn2.microsoft.com/en-us/library/2h3syy57.aspx

> >
> > Once you've created the DateTime structure, you
can display the
> value using
> > it's ToString() method
> >
> > DateTime EnteredDate =
DateTime.Parse(EnteredString);
> > string FormattedDate =
EnteredDate.ToString("MM-dd-yyyy"); //case
> matters,
> > mm is minutes
> >
> > On 1/28/07, OwaiZ <owaiz_vaiyani...>
wrote:
> > >
> > > hi
> > > any know how to convert entered date string
from dd-mm-yyyy to mm-
> dd-
> > > yyyy when using update in gridview
> > > thanks
> > >
> > >
> > >
> >
> >
> >
> > --
> > Dean Fiala
> > Very Practical Software, Inc
> > Now with Blogging...
> > http://www.vpsw.com/blog
baby
> > Microsoft MVP
> >
> >
> > [Non-text portions of this message have been
removed]
> >
>
> 
>



-- 
Dean Fiala
Very Practical Software, Inc
Now with Blogging...
http://www.vpsw.com/blog
baby
Microsoft MVP


[Non-text portions of this message have been removed]



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/join

    (Yahoo! ID required)

<*> To change settings via email:
    mailto:AspNetAnyQuestionIsOk-digest@yahoogroups.com 
   
mailto:AspNetAnyQuestionIsOk-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    AspNetAnyQuestionIsOk-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )