// RecordDoubleClicked event for setting the selected record value to TextBox in grid
void GridGroupingControl2_RecordDoubleClicked(object sender, RecordDoubleClickEventArgs e)
{
int rowindex = this.GridGroupingControl1.Table.CurrentRecord.GetRowIndex();
string ID, Name, Number, Telephone, Currency;
ID = e.Row.Record.GetValue("ID").ToString();
Name = e.Row.Record.GetValue("Name").ToString();
Number = e.Row.Record.GetValue("Number").ToString();
Currency = e.Row.Record.GetValue("Currency").ToString();
Telephone = e.Row.Record.GetValue("Telephone").ToString();
modalpopup1.Hide();
//Hidden data sent in RecordDoubleClicked event
this.TextModify.Value = ID + "," + Name + "," + Number + "," + Currency + "," + Telephone+","+rowindex;
}
//Search Button click event.
protected void Search(object sender, EventArgs e)
{
this.GridGroupingControl2.DataSource = this.GridGroupingControl1.DataSource;
Button btn = sender as Button;
GridCell cell = btn.Parent.Parent as GridCell;
TextBox text = (TextBox) cell.FindControl("SearchText");
this.GridGroupingControl2.TableDescriptor.RecordFilters.Clear();
RecordFilterDescriptor rfd = new RecordFilterDescriptor();
StringBuilder sb = new StringBuilder();
string searchtext = text.Text;
foreach (GridVisibleColumnDescriptor gcd in this.GridGroupingControl2.TableDescriptor.VisibleColumns)
{
sb.AppendFormat("[{0}] like '*{1}*' OR ", gcd.Name, searchtext);
}
//remove last ' OR '
sb.Remove(sb.Length - 4, 4);
rfd.Expression = sb.ToString();
//Adding filter from the textbox value.
this.GridGroupingControl2.TableDescriptor.RecordFilters.Add(rfd);
modalpopup1.Show();
}
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
function EndRequestHandler(sender, args)
{
var hidden = document.getElementById('TextModify').value;
var temp = new Array();
temp = hidden.split(',');
var id = 'GridGroupingControl1~TR~0~_TOPGROUP_^' + (temp[5] - 3) + '*R0^ID';
var name = 'GridGroupingControl1~TR~0~_TOPGROUP_^' + (temp[5] - 3) + '*R0^Name';
var number = 'GridGroupingControl1~TR~0~_TOPGROUP_^'+(temp[5]-3)+'*R0^Number';
var currency = 'GridGroupingControl1~TR~0~_TOPGROUP_^'+(temp[5]-3)+'*R0^Currency';
var telephone = 'GridGroupingControl1~TR~0~_TOPGROUP_^'+(temp[5]-3)+'*R0^Telephone';
$('input[id="' + id + '"]').val(temp[0]);
$('input[id="' + name + '"]').val(temp[1]);
$('input[id="' + number + '"]').val(temp[2]);
$('input[id="' + currency + '"]').val(temp[3]);
$('input[id="' + telephone + '"]').val(temp[4]);
}
|
//Getting the record value
private void setBtn_Click(object sender, EventArgs e)
{
if(this.gridGroupingControl1.Table.SelectedRecords.Count > 0)
{
string text = this.gridGroupingControl1.Table.SelectedRecords[0].Record["CategoryID"].ToString();
record.SetValue("CategoryID", text);
}
}
//Creating instance to form2
private void GridGroupingControl1_TableControlCellButtonClicked(object sender, GridTableControlCellButtonClickedEventArgs e)
{
Record record = this.gridGroupingControl1.Table.DisplayElements[e.Inner.RowIndex].GetRecord();
if (e.Inner.Button.Text=="Search")
{
form2 = new Form2(this.gridGroupingControl1, record);
form2.Show();
}
else if (e.Inner.Button.Text == "Clear")
{
record.SetValue("CategoryID", string.Empty);
}
} |