Home All Groups Group Topic Archive Search About
Author
24 Feb 2005 5:05 AM
Jeronimo Bertran
I have created a datagrid with a select button so that a user can select a
particular row.  I did this by setting the CommandName="select".  And
everything works fine.  I now want to a add a second button that first
selects the row clicked and then performs a second task with that row.

How can I achieve this?

Thanks,

Jeronimo Bertran

Author
24 Feb 2005 8:55 AM
Steven Cheng[MSFT]
Hi Jeronimo,

Welcome to MSDN newsgroup. From your description, you want to add a custom
button column in a webform datagrid. When the user click that button, that
certain row will turn into select mode and also perform
some other operate, yes?

Would you provide some further description on the "a second task"? Is it a
serverside task or a clientside task? If a serverside task, is it possbile
that we perform it just in the DataGrid's ItemCommand event when fired by
the button clicked event?

Please feel free to let me know if you have any certain concern on this.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
24 Feb 2005 6:56 PM
Jeronimo Bertran
Hi Steven,

The additional task is a server side task.  But it is a different task that
the one performed when the select button is pressed.

Thanks


v-sch***@online.microsoft.com (Steven Cheng[MSFT]) wrote in
Show quoteHide quote
news:jn1pt6kGFHA.1136@TK2MSFTNGXA02.phx.gbl:

> Hi Jeronimo,
>
> Welcome to MSDN newsgroup. From your description, you want to add a
> custom button column in a webform datagrid. When the user click that
> button, that certain row will turn into select mode and also perform
> some other operate, yes?
>
> Would you provide some further description on the "a second task"? Is
> it a serverside task or a clientside task? If a serverside task, is it
> possbile that we perform it just in the DataGrid's ItemCommand event
> when fired by the button clicked event?
>
> Please feel free to let me know if you have any certain concern on
> this.
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
Author
25 Feb 2005 9:23 AM
Steven Cheng[MSFT]
Hi Jeronimo,

Thanks for your followup. Then, since the task the second button to do is a
serverside task, is it ok that we provide a helper function to do the work
and put the function in the ItemCommand event of the datagrid?
All the postback event raise by buttons(or other submit controls) in
datagridrow will fire the DataGrid's
ItemCommand event.

Thanks,


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
26 Feb 2005 12:13 AM
Jeronimo Bertran
However, even if we use the ItemCommand Event, the clicked row is not
selected on the datagrid.  I want to have the row selected and then perform
the additional task.


v-sch***@online.microsoft.com (Steven Cheng[MSFT]) wrote in
Show quoteHide quote
news:QpSc9uxGFHA.400@TK2MSFTNGXA02.phx.gbl:

> Hi Jeronimo,
>
> Thanks for your followup. Then, since the task the second button to do
> is a serverside task, is it ok that we provide a helper function to do
> the work and put the function in the ItemCommand event of the
> datagrid? All the postback event raise by buttons(or other submit
> controls) in datagridrow will fire the DataGrid's
> ItemCommand event.
>
> Thanks,
>
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
>
Author
28 Feb 2005 11:12 AM
Steven Cheng[MSFT]
Thanks for your reply Jeronimo,

AS for selecting a row, we need to set the SelectItemIndex and them rebind
the grid with the datasource. So when we  want to both select a certain row
and perform some further operations, we should also rebind the grid with
the datasource(just like in SelectCommand) and then do that additional
task.
In addition, do you think it's possible that we register some client script
in the ItemCommand which used to post back the form again to do the
additional task? That means in the first post back(itemcommend) , we do row
selection, and in the second postback, we do the further task?

Thanks,


Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
2 Mar 2005 6:09 PM
Jeronimo Bertran
Steven,

Yes, we could register a client script for the ItemCommand... would the
commandName be "select" for this button as well?  Could you elaborate on
that idea?

Thanks

v-sch***@online.microsoft.com (Steven Cheng[MSFT]) wrote in
Show quoteHide quote
news:PYLRvZYHFHA.1252@TK2MSFTNGXA02.phx.gbl:

> Thanks for your reply Jeronimo,
>
> AS for selecting a row, we need to set the SelectItemIndex and them
> rebind the grid with the datasource. So when we  want to both select a
> certain row and perform some further operations, we should also rebind
> the grid with the datasource(just like in SelectCommand) and then do
> that additional task.
> In addition, do you think it's possible that we register some client
> script in the ItemCommand which used to post back the form again to do
> the additional task? That means in the first post back(itemcommend) ,
> we do row selection, and in the second postback, we do the further
> task?
>
> Thanks,
>
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
3 Mar 2005 7:32 AM
Steven Cheng[MSFT]
Hi Jeronimo,

Thanks for your followup. Yes, the commandName could be the same as the
"Select" button, but why would you do so  since it'll make it
undistinguishable from the select button? 
What I means in the last message is to  put a button column in the
datagrid, the commandName of the button be set to another value rather than
the "Select" , then when the button is clicked, the page is posteback and
in the ItemCommand event, we register  a script block which will post back
the page again , so that we can do the additional works. (such as
document.forms[0].submit()) or call the auto generated __doPostBack)

How do you think of this?

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
3 Mar 2005 10:21 PM
Jeronimo Bertran
v-sch***@online.microsoft.com (Steven Cheng[MSFT]) wrote in
news:DHP88M8HFHA.1136@TK2MSFTNGXA02.phx.gbl:



Thanks Steven, I will give it a try.
Author
4 Mar 2005 2:37 AM
Steven Cheng[MSFT]
You're welcome.

If there is any further questions, please feel free to post here.
Good Luck!

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)