Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > datagrid update Command

Reply
Thread Tools

datagrid update Command

 
 
=?Utf-8?B?c2lhag==?=
Guest
Posts: n/a
 
      03-04-2005
Hello All,
If some one has faced a similar issue..
My datagrid Update command is not getting fired in fact it seems that the no
event fires on clicking the update link. Although the cancel and the Edit
Commmand are getting fired properly.

The One difference I have seen is that in the task bar ..on hovering on the
link the javascript for the update link seems different. I dont know if it
makes sense..

Edit Button : javascript:__doPostBack('DataGrid1$_ctl7$_ctl3','' )
Cancel buton : javascript:__doPostBack('DataGrid1$_ctl7$_ctl0','' )
Update button :
javascript:{if%20(typeof(Page_ClientValidate)%20!= %20'function'%20||%20%20Page_ClientValidate())%20_ _doPostBack('DataGrid1$_ctl7$_ctl2','')}

fyi..
I have in the HTML datagrid code OnUpdateCommand="DataGrid1_UpdateCommand"
and in Code behind..
Public Sub DataGrid1_UpdateCommand(ByVal source As System.Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles
DataGrid1.UpdateCommand

Cheers,
siaj




 
Reply With Quote
 
 
 
 
Elton Wang
Guest
Posts: n/a
 
      03-05-2005
Do you add any validator control in your page?

you may show us more detailed info, such as your HTML
datagrid code.

BTH, Since you have
Handles DataGrid1.UpdateCommand behind Sub
DataGrid1_UpdateCommand(ByVal source As System.Object,
ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs ), you
don't need OnUpdateCommand="DataGrid1_UpdateCommand"
in HTML code. That may trigger the event twice.

Elton Wang
http://www.velocityreviews.com/forums/(E-Mail Removed)


>-----Original Message-----
>Hello All,
>If some one has faced a similar issue..
>My datagrid Update command is not getting fired in fact

it seems that the no
>event fires on clicking the update link. Although the

cancel and the Edit
>Commmand are getting fired properly.
>
>The One difference I have seen is that in the task

bar ..on hovering on the
>link the javascript for the update link seems different.

I dont know if it
>makes sense..
>
>Edit Button : javascript:__doPostBack('DataGrid1$_ctl7

$_ctl3','')
>Cancel buton : javascript:__doPostBack('DataGrid1$_ctl7

$_ctl0','')
>Update button :
>javascript:{if%20(typeof(Page_ClientValidate)%20! =%

20'function'%20||%20%20Page_ClientValidate())%
20__doPostBack('DataGrid1$_ctl7$_ctl2','')}
>
>fyi..
>I have in the HTML datagrid code

OnUpdateCommand="DataGrid1_UpdateCommand"
>and in Code behind..
>Public Sub DataGrid1_UpdateCommand(ByVal source As

System.Object, ByVal e As
>System.Web.UI.WebControls.DataGridCommandEventArg s)

Handles
>DataGrid1.UpdateCommand
>
>Cheers,
>siaj
>
>
>
>
>.
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?c2lhag==?=
Guest
Posts: n/a
 
      03-05-2005
U r right sir.. thanks..
I was having a validation on a different text box on the same form(To add
user). This Text box gets visible only when user clicks on button addUser.
What was happening was that when ever I was clicking update on datagrid, post
back was happening and the validation was getting fired for the empty
UserName text box( for adduser) which is hidden.
Now the scenario appears proper , and this is how It should happen i.e
UserName textbox will be empty while I am updating a value in the grid. How
should I take care that the validation for the AddUser should get fired only
when I am trying to save new user not when postback is happening due to some
other reason in the web form(for eg in the datagrid in this case).

Will appreciate any idea..

cheers,
siaj

"Elton Wang" wrote:

> Do you add any validator control in your page?
>
> you may show us more detailed info, such as your HTML
> datagrid code.
>
> BTH, Since you have
> Handles DataGrid1.UpdateCommand behind Sub
> DataGrid1_UpdateCommand(ByVal source As System.Object,
> ByVal e As
> System.Web.UI.WebControls.DataGridCommandEventArgs ), you
> don't need OnUpdateCommand="DataGrid1_UpdateCommand"
> in HTML code. That may trigger the event twice.
>
> Elton Wang
> (E-Mail Removed)
>
>
> >-----Original Message-----
> >Hello All,
> >If some one has faced a similar issue..
> >My datagrid Update command is not getting fired in fact

> it seems that the no
> >event fires on clicking the update link. Although the

> cancel and the Edit
> >Commmand are getting fired properly.
> >
> >The One difference I have seen is that in the task

> bar ..on hovering on the
> >link the javascript for the update link seems different.

> I dont know if it
> >makes sense..
> >
> >Edit Button : javascript:__doPostBack('DataGrid1$_ctl7

> $_ctl3','')
> >Cancel buton : javascript:__doPostBack('DataGrid1$_ctl7

> $_ctl0','')
> >Update button :
> >javascript:{if%20(typeof(Page_ClientValidate)%20! =%

> 20'function'%20||%20%20Page_ClientValidate())%
> 20__doPostBack('DataGrid1$_ctl7$_ctl2','')}
> >
> >fyi..
> >I have in the HTML datagrid code

> OnUpdateCommand="DataGrid1_UpdateCommand"
> >and in Code behind..
> >Public Sub DataGrid1_UpdateCommand(ByVal source As

> System.Object, ByVal e As
> >System.Web.UI.WebControls.DataGridCommandEventArg s)

> Handles
> >DataGrid1.UpdateCommand
> >
> >Cheers,
> >siaj
> >
> >
> >
> >
> >.
> >

>

 
Reply With Quote
 
Elton Wang
Guest
Posts: n/a
 
      03-05-2005
Hi siaj,

If the validation only affects Update, you might use
following logic:

In EditCommand event (after that, update and cancel will
be enabled)
disable validation
(you might also disable AddUser button here)
In UpdateCommand and CacellCommand (after that, it will
return normal state)
enable validation
(enable AddUser button)

HTH

Elton Wang



>-----Original Message-----
>U r right sir.. thanks..
>I was having a validation on a different text box on the

same form(To add
>user). This Text box gets visible only when user clicks

on button addUser.
>What was happening was that when ever I was clicking

update on datagrid, post
>back was happening and the validation was getting fired

for the empty
>UserName text box( for adduser) which is hidden.
>Now the scenario appears proper , and this is how It

should happen i.e
>UserName textbox will be empty while I am updating a

value in the grid. How
>should I take care that the validation for the AddUser

should get fired only
>when I am trying to save new user not when postback is

happening due to some
>other reason in the web form(for eg in the datagrid in

this case).
>
>Will appreciate any idea..
>
>cheers,
>siaj
>
>"Elton Wang" wrote:
>
>> Do you add any validator control in your page?
>>
>> you may show us more detailed info, such as your HTML
>> datagrid code.
>>
>> BTH, Since you have
>> Handles DataGrid1.UpdateCommand behind Sub
>> DataGrid1_UpdateCommand(ByVal source As System.Object,
>> ByVal e As
>> System.Web.UI.WebControls.DataGridCommandEventArgs ),

you
>> don't need OnUpdateCommand="DataGrid1_UpdateCommand"
>> in HTML code. That may trigger the event twice.
>>
>> Elton Wang
>> (E-Mail Removed)
>>
>>
>> >-----Original Message-----
>> >Hello All,
>> >If some one has faced a similar issue..
>> >My datagrid Update command is not getting fired in

fact
>> it seems that the no
>> >event fires on clicking the update link. Although the

>> cancel and the Edit
>> >Commmand are getting fired properly.
>> >
>> >The One difference I have seen is that in the task

>> bar ..on hovering on the
>> >link the javascript for the update link seems

different.
>> I dont know if it
>> >makes sense..
>> >
>> >Edit Button : javascript:__doPostBack('DataGrid1

$_ctl7
>> $_ctl3','')
>> >Cancel buton : javascript:__doPostBack('DataGrid1$_ctl7

>> $_ctl0','')
>> >Update button :
>> >javascript:{if%20(typeof(Page_ClientValidate)%20! =%

>> 20'function'%20||%20%20Page_ClientValidate())%
>> 20__doPostBack('DataGrid1$_ctl7$_ctl2','')}
>> >
>> >fyi..
>> >I have in the HTML datagrid code

>> OnUpdateCommand="DataGrid1_UpdateCommand"
>> >and in Code behind..
>> >Public Sub DataGrid1_UpdateCommand(ByVal source As

>> System.Object, ByVal e As
>> >System.Web.UI.WebControls.DataGridCommandEventArg s)

>> Handles
>> >DataGrid1.UpdateCommand
>> >
>> >Cheers,
>> >siaj
>> >
>> >
>> >
>> >
>> >.
>> >

>>

>.
>

 
Reply With Quote
 
=?Utf-8?B?c2lhag==?=
Guest
Posts: n/a
 
      03-07-2005
Thanks Elton..
It works..
siaj

"Elton Wang" wrote:

> Hi siaj,
>
> If the validation only affects Update, you might use
> following logic:
>
> In EditCommand event (after that, update and cancel will
> be enabled)
> disable validation
> (you might also disable AddUser button here)
> In UpdateCommand and CacellCommand (after that, it will
> return normal state)
> enable validation
> (enable AddUser button)
>
> HTH
>
> Elton Wang
>
>
>
> >-----Original Message-----
> >U r right sir.. thanks..
> >I was having a validation on a different text box on the

> same form(To add
> >user). This Text box gets visible only when user clicks

> on button addUser.
> >What was happening was that when ever I was clicking

> update on datagrid, post
> >back was happening and the validation was getting fired

> for the empty
> >UserName text box( for adduser) which is hidden.
> >Now the scenario appears proper , and this is how It

> should happen i.e
> >UserName textbox will be empty while I am updating a

> value in the grid. How
> >should I take care that the validation for the AddUser

> should get fired only
> >when I am trying to save new user not when postback is

> happening due to some
> >other reason in the web form(for eg in the datagrid in

> this case).
> >
> >Will appreciate any idea..
> >
> >cheers,
> >siaj
> >
> >"Elton Wang" wrote:
> >
> >> Do you add any validator control in your page?
> >>
> >> you may show us more detailed info, such as your HTML
> >> datagrid code.
> >>
> >> BTH, Since you have
> >> Handles DataGrid1.UpdateCommand behind Sub
> >> DataGrid1_UpdateCommand(ByVal source As System.Object,
> >> ByVal e As
> >> System.Web.UI.WebControls.DataGridCommandEventArgs ),

> you
> >> don't need OnUpdateCommand="DataGrid1_UpdateCommand"
> >> in HTML code. That may trigger the event twice.
> >>
> >> Elton Wang
> >> (E-Mail Removed)
> >>
> >>
> >> >-----Original Message-----
> >> >Hello All,
> >> >If some one has faced a similar issue..
> >> >My datagrid Update command is not getting fired in

> fact
> >> it seems that the no
> >> >event fires on clicking the update link. Although the
> >> cancel and the Edit
> >> >Commmand are getting fired properly.
> >> >
> >> >The One difference I have seen is that in the task
> >> bar ..on hovering on the
> >> >link the javascript for the update link seems

> different.
> >> I dont know if it
> >> >makes sense..
> >> >
> >> >Edit Button : javascript:__doPostBack('DataGrid1

> $_ctl7
> >> $_ctl3','')
> >> >Cancel buton : javascript:__doPostBack('DataGrid1$_ctl7
> >> $_ctl0','')
> >> >Update button :
> >> >javascript:{if%20(typeof(Page_ClientValidate)%20! =%
> >> 20'function'%20||%20%20Page_ClientValidate())%
> >> 20__doPostBack('DataGrid1$_ctl7$_ctl2','')}
> >> >
> >> >fyi..
> >> >I have in the HTML datagrid code
> >> OnUpdateCommand="DataGrid1_UpdateCommand"
> >> >and in Code behind..
> >> >Public Sub DataGrid1_UpdateCommand(ByVal source As
> >> System.Object, ByVal e As
> >> >System.Web.UI.WebControls.DataGridCommandEventArg s)
> >> Handles
> >> >DataGrid1.UpdateCommand
> >> >
> >> >Cheers,
> >> >siaj
> >> >
> >> >
> >> >
> >> >
> >> >.
> >> >
> >>

> >.
> >

>

 
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
Datagrid update command - and validators John Blair ASP .Net 4 01-30-2008 01:23 PM
How to call javascript when click update command(it Edit command c prakash ASP .Net Web Controls 2 04-11-2005 04:07 AM
datagrid update command =?Utf-8?B?YWJkb2x5?= ASP .Net 10 03-19-2005 01:01 PM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM
copying value of DDL in a Datagrid "pre-edit command" to value in "post edit command" San Diego Guy ASP .Net 0 08-07-2003 08:59 PM



Advertisments