Hi,
I am trying to access the text box in a radgrid and pass the values of the selected row in the grid with the new value in the textbox to a radwindow which is opened when a button in the same row is clicked.
I am using the following code
aspx:
function ShowDispatchNote(rowIndex, MediaID, ReferenceText) {
var grid = $find("<%= rgBookoutMedia.ClientID %>");
var firstDataItem = $find("<%=rgBookoutMedia.ClientID %>").get_masterTableView().get_dataItems()[rowIndex];
var MediaID = firstDataItem.getDataKeyValue("MediaID");
var masterTable = grid.get_masterTableView();
for (var i = 0; i < masterTable.get_dataItems().length; i++) {
// to access the textbox in each row
var txtbx = masterTable.get_dataItems()[i].findElement("rtbReference");
// set alert
}
window.radopen("DispatchNote.aspx?MediaID=" + MediaID + "&ReferenceText=" + txtbx.Text, "RadWindow1");
return false;
}
cs:
if (e.Item is GridDataItem)
{
GridDataItem dataItem = rgBookoutMedia.NamingContainer as GridDataItem;
Button btnConfirm = (Button)e.Item.FindControl("btnConfirm");
RadTextBox rtbReference = (RadTextBox)e.Item.FindControl("rtbReference");
btnConfirm.Attributes["onclick"] = String.Format("return ShowDispatchNote('{0}','{1}');", e.Item.ItemIndex, e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MediaID"], rtbReference.Text);
}
I am able to get the value of MediaID as I have specified it as DataKeyNames in the MasterTableView. The other query string ReferenceText shows up as undefined always. How do I get the value of the textbox with new values in the client side before opening the rad window.
The example in http://www.telerik.com/community/code-library/aspnet-ajax/grid/accessing-server-controls-in-a-grid-template-on-the-client.aspx doesn't satisfy my criteria. Can anyone show me a code sample on how to pass the new textbox value to the radwindow.
Thanks
Prithvi
I am trying to access the text box in a radgrid and pass the values of the selected row in the grid with the new value in the textbox to a radwindow which is opened when a button in the same row is clicked.
I am using the following code
aspx:
function ShowDispatchNote(rowIndex, MediaID, ReferenceText) {
var grid = $find("<%= rgBookoutMedia.ClientID %>");
var firstDataItem = $find("<%=rgBookoutMedia.ClientID %>").get_masterTableView().get_dataItems()[rowIndex];
var MediaID = firstDataItem.getDataKeyValue("MediaID");
var masterTable = grid.get_masterTableView();
for (var i = 0; i < masterTable.get_dataItems().length; i++) {
// to access the textbox in each row
var txtbx = masterTable.get_dataItems()[i].findElement("rtbReference");
// set alert
}
window.radopen("DispatchNote.aspx?MediaID=" + MediaID + "&ReferenceText=" + txtbx.Text, "RadWindow1");
return false;
}
cs:
if (e.Item is GridDataItem)
{
GridDataItem dataItem = rgBookoutMedia.NamingContainer as GridDataItem;
Button btnConfirm = (Button)e.Item.FindControl("btnConfirm");
RadTextBox rtbReference = (RadTextBox)e.Item.FindControl("rtbReference");
btnConfirm.Attributes["onclick"] = String.Format("return ShowDispatchNote('{0}','{1}');", e.Item.ItemIndex, e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["MediaID"], rtbReference.Text);
}
I am able to get the value of MediaID as I have specified it as DataKeyNames in the MasterTableView. The other query string ReferenceText shows up as undefined always. How do I get the value of the textbox with new values in the client side before opening the rad window.
The example in http://www.telerik.com/community/code-library/aspnet-ajax/grid/accessing-server-controls-in-a-grid-template-on-the-client.aspx doesn't satisfy my criteria. Can anyone show me a code sample on how to pass the new textbox value to the radwindow.
Thanks
Prithvi