List Info

Thread: Re: Gridview Edit / Update problem




Re: Gridview Edit / Update problem
user name
2007-01-30 12:41:41
Dean,

Thanks for the response.  I'm glad I am not the only one
questioning this.  I spent a lot of time creating my class
library (Project in 2.0) and data access tier .  I use add
this project as a reference for all new apps.  It is the
backbone of my system really.  It works great and now I am
totally confused why MS now wants me to access my data using
a hardcoded SQL statement in my HTML!!!  I use this tier for
ALL my data access for both my web and windows apps.  I am
about to create a new app using web services and this data
access tier will once again be used.  And like you said, I
want my presentation layer to only contain my server
controls, html, and javascript.  I too, like to keep this
light.  And of course I use the code behind for my business
logic.  

I think you are right about MS.  They are trying to make it
easier for the graphic artists and such to be able to do
some "programming".  Well, I remember when
Microsoft first sold Access and touted that product as a
tool that non-programmers could use to create small apps.  I
made a ton of money as a consultant in the 90's fixing the
messes that accountants made using Access.  You know, like
putting every field in one gigantic table!    Sounds
like the same thing could happen here.  

-------------- Original message -------------- 
From: "Dean Fiala" <dfialagmail.com> 
Bob,
That's an excellent question. I am *trying* to look at these
changes with
an unjaundiced eye, and have been experimenting with the new
approach when
people have posted questions about them.

However, I am having a hard time casting off my n-tier
background and
accepting it. I don't want frickin' SQL statements in my
aspx. I want a
light page that concerns itself with displaying information,
that doesn't
get tangled up with data sources, business logic, etc. I
don't want to try
and sort through 40 property settings to figure out why
something isn't
working. I'd rather have clean interfaces and code I can
isolate and step
through.

IMHO, all these goodies are yet another in a long series of
attempts to
allow non-programmers to "program". They work
great for simple pages and
have a place in prototypes, but I don't think they scale
well to more
complex applications. I also keep running into things that
smell of the
evils of bound controls in earlier incarnations of VB. As
soon as you want
to do something that isn't "by the book" you end
up writing a lot of code to
get around the limitations of the model, instead of writing
useful code.

That being said, I believe you can use ObjectDataSources as
your binding
source and perhaps get the best of both worlds. I haven't
played with these
at all yet, but they might be worth investigating.

On 1/30/07, rherrmann05comcast.net <rherrmann05comcast.net> wrote:
>
> Dean, that did it. Thanks once again.
>
> Off-topic here but I want to know more about these new
datasource controls
> in ASP.Net 2.0. I have spent a lot of time creating a
class library in
> ASP.Net 1.1. My class files would contain properties
and methods mostly
> used for retrieving, updating, inserting, and deleting
data with SQL stored
> procedures. I use the Microsoft application data blocks
as well in these
> classes. I can then use these classes for my web and
windows apps.
> Everything was swell.
>
> Now 2.0 comes along and all I see are these examples of
database access
> with these new controls embedded right in the aspx. And
I see SQL statements
> hardcoded right in the aspx. Am I missing something
here? Should I abandon
> my classes and use this new approach? I do see that a
lot of the gridview
> properties and methods only work if use this new
approach. So what the hell
> should I do?!?!? 
>
> Bob
>
> -------------- Original message --------------
> From: "Dean Fiala" <dfialagmail.com
<dfiala%40gmail.com>>
> OK,
> This is a side-effect of M$'s declarative programming
binge. The
> e.NewValues, e.OldValues only get populated when you
are using a
> datasource
> control to bind to the GridView. Doesn't seem to be
well documented.
>
> So, to get the value if you are not doing this, you
need just a little
> something to get a reference to the GridViewRow control
and then go about
> your business the old way.
>
> Dim Row As GridViewRow = GridView1.Rows(e.RowIndex)
>
> Dim Text As TextBox =
Row.FindControl("name")
>
> On 1/29/07, dwaynedhope.net <dwayne%40dhope.net>
<dwaynedhope.net<dwayne%40dhope.net>>
> wrote:
> >
> > I haven't tried this, but I believe you can use
e.NewValues["name" or
> > index] to retrieve the value and then cast it into
the correct data
> type.
> >
> > Dwayne
> >
> > ----- Original Message ----
> > From: "rherrmann05comcast.net
<rherrmann05%40comcast.net><rherrmann05%40comcast.n
et>" <
> > rherrmann05comcast.net
<rherrmann05%40comcast.net><rherrmann05%40comcast.n
et>>
> > To:
AspNetAnyQuestionIsOk@yahoogroups.com<AspNetAnyQuestionIs
Ok%40yahoogroups.com>
> <AspNetAnyQuestionIsOk%40yahoogroups.com>
> > Sent: Monday, January 29, 2007 1:59:44 PM
> > Subject: Re: [AspNetAnyQuestionIsOk] Gridview Edit
/ Update problem
> >
> > Hey Dean. Thanks for the reply. Actually I tried
that before I posted
> > here. I get this error when I try this:
> >
> > Item is not a member of System.Web.Iu.
Webcontrols. GridviewUpdateEv
> > entArgs.
> >
> > Thanks,
> > Bob
> >
> > ------------ -- Original message ------------ --
> > From: "Dean Fiala" <dfialagmail.
com>
> > Dim tCaseVolume As TextBox = CType(e.Item.
FindControl( "YourTextBoxName
> > Here",
> > TextBox)
> >
> > On 1/29/07, rherrmann05 comcast.net
<rherrmann05 comcast.net> wrote:
> > >
> > > Hi all,
> > >
> > > I have a gridview on a web page and now want
to make a few columns
> > > editable. I used to do this with a datagrid
and never had a problem.
> But
> > I
> > > am struggling with the gridview syntax.
Presently, I can click the
> Edit
> > > button on a row in my grid and the editable
column becomes a textbox.
> > The
> > > Updat and Cancel buttons are now displayed.
The Cancel button works
> > fine.
> > > But I do not know how to extract the value of
the textbox so that i
> can
> > save
> > > it. I am very close. Maybe someone can help
me. Here is my code: The
> > line
> > > where I Dim tCaseVolume is where I am having
problems getting my
> value.
> > >
> > > Sub UpdateRow(ByVal sender As Object, ByVal e
As
> > > System.Web.UI. WebControls. GridViewUpdateEv
entArgs) Handles
> > > gvCategories. RowUpdating
> > > Dim tCaseVolume As TextBox =
CType(e.NewValues( ).Item(0) , TextBox)
> > > Dim objPerformanceMinim ums As New
> > > PerformanceMinimums (Session(
"ConnectionStrin g"))
> > > objPerformanceMinim ums.Save( 0,
CInt(Session( "ProjectID" )),
> > > tCaseVolume. Text)
> > > gvCategories. EditIndex = -1
> > > BindGrid()
> > > End Sub
> > >
> > > Thanks!
> > > Bob
> > >
> > > [Non-text portions of this message have been
removed]
> > >
> > >
> > >
> >
> > --
> > Dean Fiala
> > Very Practical Software, Inc
> > Now with Blogging...
> > http://www.vpsw.
com/blogbaby
> > Microsoft MVP
> >
> > [Non-text portions of this message have been
removed]
> >
> > [Non-text portions of this message have been
removed]
> >
> > [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]
>
> [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]


 

[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: Gridview Edit / Update problem
user name
2007-01-30 13:47:49
Bob,
There's definitely no point in drinking the kool-aid if you
already have a
working implementation that you are using.  I'd just explore
the new goodies
as much as possible and see what is useful.

While this programming model is annoying, it is also -- as
you've stated --
a proven strategy for MS. Making development
"appear" simple gets a lot of
projects started with a corresponding investment in MS
technology. Even if
the majority of these projects go splat, they have gotten MS
in the door.
And if the project does "something" somewhat right
and/or has generated
large sunk costs, it will likely be continued once the
company can locate
the right person or people to pick it up.  As you also said,
a good time to
be a consultant.

On 1/30/07, rherrmann05comcast.net <rherrmann05comcast.net> wrote:
>
>   Dean,
>
> Thanks for the response. I'm glad I am not the only one
questioning this.
> I spent a lot of time creating my class library
(Project in 2.0) and data
> access tier . I use add this project as a reference for
all new apps. It is
> the backbone of my system really. It works great and
now I am totally
> confused why MS now wants me to access my data using a
hardcoded SQL
> statement in my HTML!!! I use this tier for ALL my data
access for both my
> web and windows apps. I am about to create a new app
using web services and
> this data access tier will once again be used. And like
you said, I want my
> presentation layer to only contain my server controls,
html, and javascript.
> I too, like to keep this light. And of course I use the
code behind for my
> business logic.
>
> I think you are right about MS. They are trying to make
it easier for the
> graphic artists and such to be able to do some
"programming". Well, I
> remember when Microsoft first sold Access and touted
that product as a tool
> that non-programmers could use to create small apps. I
made a ton of money
> as a consultant in the 90's fixing the messes that
accountants made using
> Access. You know, like putting every field in one
gigantic table!  Sounds
> like the same thing could happen here.
>
> -------------- Original message --------------
> From: "Dean Fiala" <dfialagmail.com
<dfiala%40gmail.com>>
> Bob,
> That's an excellent question. I am *trying* to look at
these changes with
> an unjaundiced eye, and have been experimenting with
the new approach when
> people have posted questions about them.
>
> However, I am having a hard time casting off my n-tier
background and
> accepting it. I don't want frickin' SQL statements in
my aspx. I want a
> light page that concerns itself with displaying
information, that doesn't
> get tangled up with data sources, business logic, etc.
I don't want to try
> and sort through 40 property settings to figure out why
something isn't
> working. I'd rather have clean interfaces and code I
can isolate and step
> through.
>
> IMHO, all these goodies are yet another in a long
series of attempts to
> allow non-programmers to "program". They work
great for simple pages and
> have a place in prototypes, but I don't think they
scale well to more
> complex applications. I also keep running into things
that smell of the
> evils of bound controls in earlier incarnations of VB.
As soon as you want
> to do something that isn't "by the book" you
end up writing a lot of code
> to
> get around the limitations of the model, instead of
writing useful code.
>
> That being said, I believe you can use
ObjectDataSources as your binding
> source and perhaps get the best of both worlds. I
haven't played with
> these
> at all yet, but they might be worth investigating.
>
> On 1/30/07, rherrmann05comcast.net
<rherrmann05%40comcast.net> <
> rherrmann05comcast.net
<rherrmann05%40comcast.net>> wrote:
> >
> > Dean, that did it. Thanks once again.
> >
> > Off-topic here but I want to know more about these
new datasource
> controls
> > in ASP.Net 2.0. I have spent a lot of time
creating a class library in
> > ASP.Net 1.1. My class files would contain
properties and methods mostly
> > used for retrieving, updating, inserting, and
deleting data with SQL
> stored
> > procedures. I use the Microsoft application data
blocks as well in these
> > classes. I can then use these classes for my web
and windows apps.
> > Everything was swell.
> >
> > Now 2.0 comes along and all I see are these
examples of database access
> > with these new controls embedded right in the
aspx. And I see SQL
> statements
> > hardcoded right in the aspx. Am I missing
something here? Should I
> abandon
> > my classes and use this new approach? I do see
that a lot of the
> gridview
> > properties and methods only work if use this new
approach. So what the
> hell
> > should I do?!?!? 
> >
> > Bob
> >
> > -------------- Original message --------------
> > From: "Dean Fiala" <dfialagmail.com
<dfiala%40gmail.com><dfiala%40gmail.com>>
> > OK,
> > This is a side-effect of M$'s declarative
programming binge. The
> > e.NewValues, e.OldValues only get populated when
you are using a
> > datasource
> > control to bind to the GridView. Doesn't seem to
be well documented.
> >
> > So, to get the value if you are not doing this,
you need just a little
> > something to get a reference to the GridViewRow
control and then go
> about
> > your business the old way.
> >
> > Dim Row As GridViewRow =
GridView1.Rows(e.RowIndex)
> >
> > Dim Text As TextBox =
Row.FindControl("name")
> >
> > On 1/29/07, dwaynedhope.net
<dwayne%40dhope.net> <dwayne%40dhope.net> <
> dwaynedhope.net
<dwayne%40dhope.net><dwayne%40dhope.net>>
> > wrote:
> > >
> > > I haven't tried this, but I believe you can
use e.NewValues["name" or
> > > index] to retrieve the value and then cast it
into the correct data
> > type.
> > >
> > > Dwayne
> > >
> > > ----- Original Message ----
> > > From: "rherrmann05comcast.net
<rherrmann05%40comcast.net><rherrmann05%40comcast.n
et><rherrmann05%40comcast.net>" <
> > > rherrmann05comcast.net
<rherrmann05%40comcast.net><rherrmann05%40comcast.n
et><rherrmann05%40comcast.net>>
> > > To:
AspNetAnyQuestionIsOk@yahoogroups.com<AspNetAnyQuestionIs
Ok%40yahoogroups.com>
> <AspNetAnyQuestionIsOk%40yahoogroups.com>
> > <AspNetAnyQuestionIsOk%40yahoogroups.com>
> > > Sent: Monday, January 29, 2007 1:59:44 PM
> > > Subject: Re: [AspNetAnyQuestionIsOk] Gridview
Edit / Update problem
> > >
> > > Hey Dean. Thanks for the reply. Actually I
tried that before I posted
> > > here. I get this error when I try this:
> > >
> > > Item is not a member of System.Web.Iu.
Webcontrols. GridviewUpdateEv
> > > entArgs.
> > >
> > > Thanks,
> > > Bob
> > >
> > > ------------ -- Original message ------------
--
> > > From: "Dean Fiala" <dfialagmail.
com>
> > > Dim tCaseVolume As TextBox = CType(e.Item.
FindControl(
> "YourTextBoxName
> > > Here",
> > > TextBox)
> > >
> > > On 1/29/07, rherrmann05 comcast.net
<rherrmann05 comcast.net> wrote:
> > > >
> > > > Hi all,
> > > >
> > > > I have a gridview on a web page and now
want to make a few columns
> > > > editable. I used to do this with a
datagrid and never had a problem.
> > But
> > > I
> > > > am struggling with the gridview syntax.
Presently, I can click the
> > Edit
> > > > button on a row in my grid and the
editable column becomes a
> textbox.
> > > The
> > > > Updat and Cancel buttons are now
displayed. The Cancel button works
> > > fine.
> > > > But I do not know how to extract the
value of the textbox so that i
> > can
> > > save
> > > > it. I am very close. Maybe someone can
help me. Here is my code: The
> > > line
> > > > where I Dim tCaseVolume is where I am
having problems getting my
> > value.
> > > >
> > > > Sub UpdateRow(ByVal sender As Object,
ByVal e As
> > > > System.Web.UI. WebControls.
GridViewUpdateEv entArgs) Handles
> > > > gvCategories. RowUpdating
> > > > Dim tCaseVolume As TextBox =
CType(e.NewValues( ).Item(0) , TextBox)
> > > > Dim objPerformanceMinim ums As New
> > > > PerformanceMinimums (Session(
"ConnectionStrin g"))
> > > > objPerformanceMinim ums.Save( 0,
CInt(Session( "ProjectID" )),
> > > > tCaseVolume. Text)
> > > > gvCategories. EditIndex = -1
> > > > BindGrid()
> > > > End Sub
> > > >
> > > > Thanks!
> > > > Bob
> > > >
> > > > [Non-text portions of this message have
been removed]
> > > >
> > > >
> > > >
> > >
> > > --
> > > Dean Fiala
> > > Very Practical Software, Inc
> > > Now with Blogging...
> > > http://www.vpsw. com/blogbaby
> > > Microsoft MVP
> > >
> > > [Non-text portions of this message have been
removed]
> > >
> > > [Non-text portions of this message have been
removed]
> > >
> > > [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]
> >
> > [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]
>
> [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 )