Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8641385
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:30:45+00:00 2026-06-12T11:30:45+00:00

I am facing a problem in grid view, basically what i am trying to

  • 0

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:

<asp:TemplateField HeaderText="FileName" ItemStyle-HorizontalAlign="Center"> 
<ItemTemplate>
<asp:LinkButton ID="btn"  runat="server" CommandName="Click"/>
</ItemTemplate> 
</asp:TemplateField>

aspx.cs

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();
}

Please help me if you have any solution

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:30:46+00:00Added an answer on June 12, 2026 at 11:30 am

    Grid is not displaying any value in my first column when i use above
    code

    You say that the LinkButton is in the first TemplateField, then you cannot set the Text property of the cell. You need to use FindControl to get a reference to your LinkButton.

    LinkButton btn = (LinkButton)e.Row.FindControl("btn");
    int EmpiD = Int32.Parse(e.Row.Cells[2].Text);
    DataSet EmpIDDs = GetEMP.getValue(EmpiD);
    DataRow EmpRow = EmpIDDs.Tables[0].Rows[0];
    btn.Text = EmpRow[3].ToString();
    

    Assuming that the rest of your code is correct, for example that the third column is a BoundField and contains an integer so that e.Row.Cells[2] works.

    I’m not sure if you’re familiar with the debugger.

    Debugging-Tutorial: http://www.dotnetperls.com/debugging

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a grid view, the problem I am facing is when there is
I am facing a very strange problem. I have a grid and when i
iam facing problem in passing array to view. this is my controller code.. function
I am facing problem while setting focus in EdiText. Below is my EditText property.
I am facing problem in intercepting and changing request url to link it with
I am facing problem to get variable from query string. I have used htaccess
I am facing problem with UIPanGestureRecognizer. suppose i am adding 10 button dynamicaly using
Im facing problem when trying to apply data annotation. In my case im passing
I'm using telerik ASP.Net Ajax grid component, and I'm facing a problem. If I'm
07-06-2011 4:34 AM | LINK Hi, We are facing a problem in Silverlight 3

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.