see this example, how to group the column names by using stored procedure.
create table employee
(
EmpName varchar(50),
Hobbies varchar(50)
)
insert into employee values ('ram','cricket')
insert into employee values ('ram','Tennis')
insert into employee values ('ram','FootBall')
In sql server 2000
select case when rn=1 then EmpName else '' end as EmpName,Hobbies
from(select *,(select count(*) from employee where EmpName = e.EmpName and Hobbies <= e.Hobbies) as rnfrom employee e) t
In SqlServer2005,
select case when rn = 1 then EmpName else '' end as EmpName,Hobbies from
(select *,row_number() over (order by EmpName) as rn from employee) t
once you group the customerno, then to group the link button, you can do one thing. in row databound event,
if(e.row.rowtype == DataControlRowType.datarow)
{
Label lblCustNo = (Label)e.row.findcontrl("lblCustNo") // here in paranthesis, name of the label in itemtemplate of the customerno field.
Linkbutton lnkSelect = (Linkbutton )e.row.findcontrl("lnkSelect ") // in paranthesis, name of the linkbutton in itemtemplate of the linkbutton field.
if(lblCustNo.Text = "")
lnkSelect.Text="";
}
Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.