private void AddParameters() { System.Collections.ObjectModel.Collection <KeyValuePair <string, string> > collection = this.GetParameters(); if (collection == null || collection.Count.Equals(0)) { ReportParameterPanel.Style.Add("display", "none"); ReportViewer1.Path = this.ReportPath(); ReportViewer1.InitializeReport(); return; } foreach (KeyValuePair <string, string> parameter in collection) { TextBox textBox = new TextBox(); textBox.ID = parameter.Key.Replace("@", "") + "_text_box"; string label = "<label for='" + textBox.ID + "'>" + MixERP.Net.Common.Helpers.LocalizationHelper.GetResourceString("FormResource", parameter.Key.Replace("@", "")) + "</label>"; if (parameter.Value.Equals("Date")) { } else { } AddRow(label, textBox); } Button button = new Button(); button.ID = "UpdateButton"; button.Text = Resources.Titles.Update; button.CssClass = "myButton"; button.Click += button_Click; AddRow("", button); }
protected void button_Click(object sender, EventArgs e) { if (ReportParameterTable.Rows.Count.Equals(0)) { return; } System.Collections.ObjectModel.Collection <KeyValuePair <string, string> > list = new System.Collections.ObjectModel.Collection <KeyValuePair <string, string> >(); foreach (TableRow row in ReportParameterTable.Rows) { TableCell cell = row.Cells[1]; if (cell.Controls[0] is TextBox) { TextBox textBox = (TextBox)cell.Controls[0]; list.Add(new KeyValuePair <string, string>("@" + textBox.ID.Replace("_text_box", ""), textBox.Text)); } } ReportViewer1.Path = this.ReportPath(); ReportViewer1.ParameterCollection = MixERP.Net.BusinessLayer.Helpers.ReportHelper.BindParameters(Server.MapPath(this.ReportPath()), list); ReportViewer1.InitializeReport(); }