c# - Edit value in DataRowView -


I am currently using VS 2008 for my development (ASP.Net C #).

I am facing a problem with Gridview at present:

I am binding data with gridview datasource using dataset (database query), then I have a checkbox that allows the user to hide or display columns using the following method:

  if (chkPhone.Checked == true) {strSQL + = ", recruitment_ Websites as "Website"; }  

Okay now the problem I am experiencing is, how do I wrap this specific column lines with anchor tags? Therefore user users can go directly to the website concerned, although Gridview.

So to use my first method was to use the 'RwDataBound' event and do something like this:

  e. Ro Seals [7]. Text = "& lt; a href = '" e. Ro Seals [7]. Text + '' & gt; Click me & lt; / A & gt; ";  

But then the problem occurs, if the user does not want to display this column, then the column index will be different. (The user has more options to hide columns, So, the index does not have 1 meaning)

Well, this approach failed, I tried to use another approach which was the 'Rodeडेटound' incident:

  If (E. Rau. Rove Type == Data Controller Type. Detroit) {DetectiveView Line View = (DetroView) E.O.Detectime; Lineview ["website"] = "Something"; // to deal with it here}  

using this method I can get the value from the gridview using the column name, but I can not set the value.

So what is the best solution for this situation?

You still have to check which columns you want to do this , But I think it can help you.

Your code to fill the dataset // foreach (dataTable theTable in DataSet.Tables) {foreach (Row in Data.Row. Rows) {foreach (DataColumn cell in.Cable.Columns) {string value = row [cell]. ToString (); Line [cell] = "& lt; a href = '" + value + "'> + Value + "& lt; / a & gt;"; }}} // Your databasesing and accessories;

This can also work:

  foreach (dataTable theTable in DataSet.Tables) {foreach (line.Row in row row.ro) {foreach (DataColumn cell in.Cable.Columns) {string value = row [cell]. ToString (); Hyperlink linker = new hyperlink (); Data column call = new dataset (); Linker.NavigateUrl = value; // You need to change it, so this col.DefaultValue = linker works; Row [cell] = cola; }}}  

The final estimate: This is not friendly, but it has worked for me before the user has to do anything, but after the database.

  foreach (GridViewRow line in GridView1.Rows) {foreach (table cell in row.Cells) {string value = col .Text.toString (); Col.Text = "& lt; a href = '" + value + "'> + Value + "& lt; / a & gt;"; }}  

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -