replace tunggal

replace tunggal

  • NA
  • 2
  • 2.1k

how to retrieve the value of the input query textbox?

Dec 18 2014 1:52 AM
example I have a textbox input, the contents of the textbox input is a query of the user what the user inputted, an example in the textbox, I try to enter text "select id, name, country from the country" .. from the sql query on the results of the 3 coloumn (id, name and country), I ask how to take the number of columns and then give the number of the column in another textbox, and give the number of columns in a gridview row, if the number of columns 3, the number of rows in the gridview also 3, I have a column in gridview named column_text. How is the content of column_text match the query (id, name, country) in gridview ..

private void BindReportColumn(String report_id) {     dt = mda.GetData("SELECT column_name,column_text,size,back_color,fore_color FROM report_column INNER JOIN report ON report_column.report_id = report.report_id and report.report_id='" + report_id + "'", connStr).Tables[0];      GridCustomColumn.DataSource = dt;     GridCustomColumn.DataBind(); }
private void addcolumn()     {         int i;         //Add the items to the gridview              DataTable dt = new DataTable();             //Assign the viewstate to the datatable             if (!IsNumeric(txtcolumn_count.Text)) txtcolumn_count.Text = "0";             dt = (DataTable)ViewState["columnreport"];              for (i = 1; i <= Convert.ToInt32(txtcolumn_count.Text); i++)             {                 DataRow dr = dt.NewRow();                 //dr["report_id"] = txtreport_id.Text;                 dr["column_name"] = "";                 dr["column_text"] = " ";                 dr["size"] = 0;                 dr["back_color"] = "";                 dr["fore_color"] = "";                 //Add the datarow to the datatable                 dt.Rows.Add(dr);                 //Now bind the datatable to the gridview                 GridCustomColumn.DataSource = dt;                 GridCustomColumn.DataBind();                   //Add the details to viewstate also                 ViewState["columnreport"] = dt;             }     }




thanks in advance

Answers (1)