Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

Help on itemtemplate, control and datagrid
Hi,

I'm tring to use item template in a datagrid and added a link button in
item template. I'm loading the value of link button dynamically by
binding dataset to a datagrid. When i click that i should be able to
retrieve the value of the link button. how can i do that? Below i'm
posting my code, can you please tell me where i'm going wrong?

ASP.NET CODE
--------------

<asp:datagrid id=DataGrid1 runat="server" Width="256px" Height="225px"
AutoGenerateColumns="False" OnItemCommand ="DataGrid1_Item1">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton ID = "link1"
Runat=server><%#DataBinder.Eval(Container.DataItem,
"city")%></asp:LinkButton></ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>



C#.NET
---------


public void DataGrid1_Item1(object sender, DataGridCommandEventArgs e)
{
string city = ((LinkButton
)DataGrid1.SelectedItem.Cells[0].Controls[0]).Text ;
Response.Write("city is:" + city);
}

Can you please tell me how to retreive the text value of link button
control in a datagrid?


Thanks & Regards,
Ratnakar Pedagani


Report this thread to moderator Post Follow-up to this message
Old Post
ratnakarp@gmail.com
05-16-05 01:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

C# archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 10:07 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.