How to pass the selected row of a datagrid to another form

A

ALI-R

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on a cell and open
another form sending all the fields in that cell to the form for future
work, how can i do this?


Thanks for you help
 
E

Eliyahu Goldin

It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx", row, "<features>");
}

Eliyahu
 
E

Elton Wang

It is pretty good.

Elton Wang
-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
 
A

ALI-R

I'm actually using a mobile form for that respect,but I think it has the
same fuctions as a win form.
What I did (which I don't like at all) is that I passed the caller form to
the child form's constructor(having the required fields defined as public in
the caller form) ,,in the child form then I set the fields to the selected
row's values.

Can u suggest me a better way of doing that in windows forms?
Thanks (I like the asp.net version too:))
Eliyahu Goldin said:
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx", row, "<features>");
}

Eliyahu

ALI-R said:
hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on a cell and open
another form sending all the fields in that cell to the form for future
work, how can i do this?


Thanks for you help
 
A

ALI-R

I tried this:
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
Elton Wang said:
It is pretty good.

Elton Wang
-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row said:
}

Eliyahu




.
 
E

Eliyahu Goldin

Yes, it was a sort a pseudocode.

ALI-R said:
I tried this:
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
Elton Wang said:
It is pretty good.

Elton Wang
-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row said:
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on a cell and open
another form sending all the fields in that cell to the form for future
work, how can i do this?


Thanks for you help




.
 
A

ALI-R

I finally passed it to the modal form,in there I don't know how to set it to
a text box?

Eliyahu Goldin said:
Yes, it was a sort a pseudocode.

ALI-R said:
I tried this:
Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
Elton Wang said:
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 
E

Elton Wang

For win form, your approach of passing caller to child
form via constructor is good. Or you can have a public
write only property in child form to pass caller to it.

For web form, you can save object to Session, then in new
page retrieve the object from Session.

HTH,

Elton Wang
(e-mail address removed)
-----Original Message-----
I'm actually using a mobile form for that respect,but I think it has the
same fuctions as a win form.
What I did (which I don't like at all) is that I passed the caller form to
the child form's constructor(having the required fields defined as public in
the caller form) ,,in the child form then I set the fields to the selected
row's values.

Can u suggest me a better way of doing that in windows forms?
Thanks (I like the asp.net version too:))
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row said:
}

Eliyahu


.
 
A

ALI-R

Thanks Elton,I'll remmeber it for web forms
Elton Wang said:
For win form, your approach of passing caller to child
form via constructor is good. Or you can have a public
write only property in child form to pass caller to it.

For web form, you can save object to Session, then in new
page retrieve the object from Session.

HTH,

Elton Wang
(e-mail address removed)
-----Original Message-----
I'm actually using a mobile form for that respect,but I think it has the
same fuctions as a win form.
What I did (which I don't like at all) is that I passed the caller form to
the child form's constructor(having the required fields defined as public in
the caller form) ,,in the child form then I set the fields to the selected
row's values.

Can u suggest me a better way of doing that in windows forms?
Thanks (I like the asp.net version too:))
It's pretty straightforward. Use ItemDataBind event to setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"] = "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row said:
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on a cell and open
another form sending all the fields in that cell to the form for future
work, how can i do this?


Thanks for you help


.
 
E

Eliyahu Goldin

It's not clear what exactly you are trying to achieve. Did you manage to
read the row parameter in the child form?

Eliyahu

ALI-R said:
I finally passed it to the modal form,in there I don't know how to set it to
a text box?

Eliyahu Goldin said:
Yes, it was a sort a pseudocode.

ALI-R said:
I tried this:
Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 
A

ALI-R

That's eaxctly what I am going to do,I mean I'd like to read the row
paramtere in the child form and pass it to a textbox.
Thanks
Eliyahu Goldin said:
It's not clear what exactly you are trying to achieve. Did you manage to
read the row parameter in the child form?

Eliyahu

ALI-R said:
I finally passed it to the modal form,in there I don't know how to set
it
to
a text box?

Eliyahu Goldin said:
Yes, it was a sort a pseudocode.

I tried this:
Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 
E

Eliyahu Goldin

You should do it on client side with javascript, for example in <body
onload...> event. The parameter is available as window.dialogArguments
property. Once you get it, you can set the value of the textbox in the same
javascript.

Eliyahu

ALI-R said:
That's eaxctly what I am going to do,I mean I'd like to read the row
paramtere in the child form and pass it to a textbox.
Thanks
Eliyahu Goldin said:
It's not clear what exactly you are trying to achieve. Did you manage to
read the row parameter in the child form?

Eliyahu

ALI-R said:
I finally passed it to the modal form,in there I don't know how to set
it
to
a text box?

Yes, it was a sort a pseudocode.

I tried this:
Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");

I got an script error ,I replaced it with this and it worked (did u
write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 
A

ALI-R

but when I use the window.dialogArguments,it returns an "object".How can I
get the value of that object in my javascript code?


Eliyahu Goldin said:
You should do it on client side with javascript, for example in <body
onload...> event. The parameter is available as window.dialogArguments
property. Once you get it, you can set the value of the textbox in the same
javascript.

Eliyahu

ALI-R said:
That's eaxctly what I am going to do,I mean I'd like to read the row
paramtere in the child form and pass it to a textbox.
Thanks
set
it
(did
u
write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 
E

Eliyahu Goldin

it's a variant. it will be of the same type you've passed. in your case you
will get the row.

Eliyahu

ALI-R said:
but when I use the window.dialogArguments,it returns an "object".How can I
get the value of that object in my javascript code?


Eliyahu Goldin said:
You should do it on client side with javascript, for example in <body
onload...> event. The parameter is available as window.dialogArguments
property. Once you get it, you can set the value of the textbox in the same
javascript.

Eliyahu
manage
to
read the row parameter in the child form?

Eliyahu

I finally passed it to the modal form,in there I don't know how to set
it
to
a text box?

Yes, it was a sort a pseudocode.

I tried this:
Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");

I got an script error ,I replaced it with this and it worked
(did
u
write
psudo code)?
window.showModalDialog("AnotherForm.aspx",row);

thanks
It is pretty good.

Elton Wang

-----Original Message-----
It's pretty straightforward. Use ItemDataBind event to
setup ondblclick
client event for every data row click. Something like

private void dgSelection_ItemDataBound(object
sender,
System.Web.UI.WebControls.DataGridItemEventArgs e)
{
ListItemType itemType = e.Item.ItemType;
if ((itemType == ListItemType.Pager) ||
(itemType == ListItemType.Header) ||
(itemType == ListItemType.Footer))
{
return;
}
e.Item.Attributes["ondblclick"]
= "onRowDblClick(this)";
}

Javascript function onRowDblClick will look like this:
function onRowDblClick (row){
call showModalDialog ("AnotherForm.aspx",
row, "<features>");
}

Eliyahu

hi all.
Can someone help me with this?
I have a Datagrid, and i would like to doubkle click on
a cell and open
another form sending all the fields in that cell to the
form for future
work, how can i do this?


Thanks for you help




.
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top