assign columns value on rowdatabound in gridview

hazeleggplant

New Member
I am facing a problem in grid view, basically what i am trying to achieve is below:I have a grid view in which my first column is a link button, i have to put a condition where value from my 2nd column is taken and is input to a c# method for poulating a value which i need to assign into my first column.I am trying below code however when i view my grid its showing 1st columns value as blank.Aspx page:\[code\]<asp:TemplateField HeaderText="FileName" ItemStyle-HorizontalAlign="Center"> <ItemTemplate><asp:LinkButton ID="btn" runat="server" CommandName="Click"/></ItemTemplate> </asp:TemplateField>\[/code\]aspx.cs\[code\]if (e.Row.RowType == DataControlRowType.DataRow){int EmpiD = Int32.Parse(e.Row.Cells[2].Text);DataSet EmpIDDs = GetEMP.getValue(EmpiD);DataRow EmpRow = EmpIDDs.Tables[0].Rows[0];e.Row.Cells[0].Text = EmpRow[3].ToString();}\[/code\]Please help me if you have any solution
 
Back
Top