Click here to Skip to main content
15,073,911 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In gridview as follows

           Compid   Companyname Address
Select       1        trom

Gridviewselected index change code as follows
protected void gvcomdet_SelectedIndexChanged(object sender, EventArgs e)
      txt_compid.text = gvcomdet.SelectedRow.Cells[1].text.tostring();
      txt_name.text = gvcomdet.SelectedRow.Cells[2].text.tostring();
      txt_address.text = gvcomdet.SelectedRow.cells[3].text.tostring()

When i click the select in gridview in textbox gridview selected row will be displayed as follows

Compid          1     (txt_compid)
Companyname     trom  (txt_name)
Address         <code>" "</code>

In address textbox txt_address shows  
i want to validate " " should not be shown in txt_address textbox it will be replaced with empty value

for that how can i validate in using c#.
Updated 23-Aug-15 20:57pm

1 solution

txt_address.text = gvcomdet.SelectedRow.cells[3].text.tostring();
txt_address.text = gvcomdet.SelectedRow.cells[3].Text.Trim();

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900