I have a gridview that gets the data from a database and it has SectorId, name,mobile
But in Database table SectorId is save in Value and i want text in Gridview on pageload
I have a gridview that gets the data from a database and it has SectorId, name,mobile
But in Database table SectorId is save in Value and i want text in Gridview on pageload
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sachin SinghPosted Mar 13, 2023, 5:57 AM
step 1:- Modify Gridview Bound field as
step 2:- Bind GridView in page load as
Garima BansalPosted Mar 13, 2023, 5:27 AM
SELECT t2.Name as Name, Name, Mobile_No, Grievance_Details,
Status FROM GrievanceDetails t1 inner join Sectors t2 on t1.Id = t2.Id WHERE Id = @Id
error i am geeting "Must declare the scalar variable "@Id"."
Garima BansalPosted Mar 13, 2023, 4:42 AM
SELECT t2.Name as Name, Name, Mobile_No, Details, Status FROM GrievanceDetails t1 inner join Sectors t2 on t1.Id = t2.Id WHERE Id = @Id //error
Jignesh KumarPosted Mar 13, 2023, 4:35 AM
can you please share code where you are getting error ?
Garima BansalPosted Mar 13, 2023, 4:33 AM
Jignesh Kumar
getting an error in sql query "scalar variable"
Jignesh KumarPosted Mar 10, 2023, 11:08 AM
Hi,
You need to add sectorname in your sql query, Use join to get sectore name based on sectorId,