HelloBD
HelloBD

Reputation: 387

How to set cell values programatically in a GridView?

Work on Asp.Net C# VS08.

I have a GridView which was binded to an ObjectDataSource with edit command link capabilities enabled.

Whenever the user go on edit a row and changes a given cell, I'd like to change another cell value programatically change a cell value (according to the new cell value typed by the user).

So, is it possible to change cell values programatically on edit mode?

I took a gridview with Five columns. In first column i have edit buttons. In second column i have name and in third i have age,StartTime,EndTime.On my name cell i used PopupControlExtender,When user click on Name Cell they see a gridview popup containing Name And Age from there they chose appropriate name.After chose the name i want Age will be set Automatically on My Age cell.

Where to Write,How to write methods.On PopupControlExtender popup grid i can select and set value on name cell using the bellow code

 protected void GridView2_SelectedIndexChanged(object sender, EventArgs e)
        {
            string b = ((Label)GridView2.SelectedRow.FindControl("lblCOM_NAME")).Text;
            AjaxControlToolkit.PopupControlExtender.GetProxyForCurrentPopup( this.Page).Commit(b);
        }

i want user click the name cell value after this age will be set automatically on Age cell from popup grid.How to set the Value?

Upvotes: 0

Views: 9956

Answers (1)

Jammin
Jammin

Reputation: 3100

Use a template column and then

row[0].Cell[0].FindControl("txtTextBox")

with the correct cast.

I dont have VS on this machine but that should be about right.

Upvotes: 1

Related Questions