Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Robert Richardson   on Apr 17 In Asp.net Category.

  
Question Answered By: Roosevelt Jenkins   on Apr 17

To move your selections to another grid you'd have to use jscript.

You'de have to have way of generating that jscript from the web page as it would
likely need to have an idea of what the controls were called in the datagrid.
The web page will generate an ID for the controls in the datagrid  ... so you
have to have a way of storing them client side in arrays to enable your
javascript to work.

Or .... just have a button or link in your first dg that calls a jscript
function with written param of the text box id's .... and the other dg that is
to recieve the choices - well the best think to do would be to have it identical
to the first grid, that way you could simply replace a part of the string in the
mentioned function and it will make the placement.

You just nee to generate the script to do it from the server, thus enabling you
to pass the correct params in the client functions that will do the work.

I wouldn't use checkboxes, I'd add a hyperlink which calls a function to make
the move, one for each row.

The html would look something like the following ... noting that all id's will
be generated by asp.NET so you need to be able to get their id's and write them
straight into your href links.


<script>
function movedata(d) {
var d2;
//.... parse d and replace dg2 with dg1 and assign to d2
var t1;
var t2;
t1 = document.forms[0].getElementById("d");
t2 = document.forms[0].getElementById("d2");
t1.Text = t2.Text;
t2.Text = ""; // perhaps
}


</script>

< input type=Text id=dg1_ctl0__ctl0>
< input type=Text id=dg1_ctl0__ctl1>
< input type=Text id=dg1_ctl0__ctl2>
< input type=Text id=dg1_ctl0__ctl3>


< input type=Text id=dg2_ctl0__ctl0><a href="javascript:void(0)"
onclick="movedata('dg2_ctl0__ctl0')>Move Data</a>
< input type=Text id=dg2_ctl0__ctl1>><a href="javascript:void(0)"
onclick="movedata('dg2_ctl0__ctl1')>Move Data</a>
< input type=Text id=dg2_ctl0__ctl2>><a href="javascript:void(0)"
onclick="movedata('dg2_ctl0__ctl2')>Move Data</a>
< input type=Text id=dg3_ctl0__ctl3>><a href="javascript:void(0)"
onclick="movedata('dg2_ctl0__ctl3')>Move Data</a>

Share: 

 

This Question has 4 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on More on the datagrid moving data between the two... Or get search suggestion and latest updates.


Tagged: