hello,
i have a win application which im doing using C# and .NET in Visual Studio 2010
i have a data grid to which im binding some data from the database. i also have two radio buttons to which im binding distinct values of a particular column from the same database table.
after loading the table, i make some changes to the radio button text,it should automatically update those values in the datagrid view also in that particular column.
please let me know of the code to implement this functionality

Hi, would you mind showing us the code you got there - would be faster to salve the issue. Thx in advance.

string select= "select * from flowdata..data6_checklistlayouts where fk_ecytypes=269"
dataset ds=objAccess.fetchfromDB(select);
datagridview1.datasource=ds.tables[0];
string radiobtn="select distinct layoutid from flowdata..data6_checklistlayouts where layoutid lik eadditional%"
dataset ds1=objAccess.fetchfromDB(radiobtn);
int i=0;
for(i=o;i<ds1.tables[0].rows[0].count;i++)
{
string[] radiobtnval=convert.tostring(ds1.tables[0]);
}
RadioTextBox1.text=radiobtnval[0];
RadioTextBox2.text=radiobtnval[1];
RadioTextBox2.text=radiobtnval[2];

Im not sure bout he queries but radiobtn query fetches 3 values and puts it in the text boxes

when i make changes in radio text boxes it has to change in datagirdview1 for layout id

datagridview1 has a column as layout id]
thanks in advance

That loop is not ok. I dont even know how the varible "radiobtnval" is accessable outside of the loop, because you initialize it inside of the loop. And one more thing. Every time the code goes throught the loop oversides the array, so it will alway be filled with only the data on the last loop.

Lets repair this loop to:

1.This is when you want to loop trought all the rows:

List<string> list = new List<string();
for(i=o;i<ds1.Tables[0].Rows.Count;i++)
     list.Add(ds.Tables[0].Rows[i]["columnName"].ToString();

RadioTextBox1.text=list[0];
RadioTextBox2.text=list[1];
RadioTextBox2.text=list[2];

Or would you like to get only values from one row? From 1st row (you stated row[0])?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.