I need help with my code,I'm showing 3 columns from a table in datase in a gridview and I want when I click on select button to show me the forth column for that row in a textbox.
this code,shows 3 columns in the gridview but when I click on a select I dont get the forth column.
I should mention that I don't want to show the forth column in the gridview I just want it to appear in textbox when I click on a select!
please tell me what else I should add to my code to make it work!
public class NewsWP : System.Web.UI.WebControls.WebParts.WebPart
{
Label messages;
GridView gridv;
SqlDataSource datasource;
SqlDataSource datasourceF;
TextBox txt1 = new TextBox();
public NewsWP()
{
}
protected override void CreateChildControls()
{
base.CreateChildControls();
// DatasSource
datasource = new SqlDataSource();
datasource.ID = "SqlDataSource1";
//DataSource for FormView
datasourceF = new SqlDataSource();
datasourceF.ID = "SqlDataSource2";
//GridView data Connection
datasource.ConnectionString = "Data Source =.\\sqlexpress;Initial Catalog=db;Integrated Security=SSPI; Integrated Security=True;Trusted_Connection=True;";
datasource.SelectCommand = "select Y,X,ID from table";
Controls.Add(datasource);
//otherGridView data Connection
datasourceF.ConnectionString = "Data Source =.\\sqlexpress;Initial Catalog=db;Integrated Security=SSPI; Integrated Security=True;Trusted_Connection=True;";
datasourceF.SelectCommand = "select T from table Where ID=@ID";
datasourceF.SelectParameters.Add(new ControlParameter("ID", "OuterGridView", "SelectedDataKey.Value"));
Controls.Add(datasourceF);
Bookmarks