Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / September 2007

Tip: Looking for answers? Try searching our database.

call a server method from gridview's template field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ganesh - 09 Sep 2007 00:21 GMT
Hi There,

I want to call a server method from gridview's template field, but it
doesn't seem to be working, any idea what is wrong in this.

Thanks
Ganesh

.aspx

<ItemTemplate>

<asp:Image BorderWidth=1 Height=16 Width=16 ID="Image1" runat="server"
ImageUrl='<%# Eval("City") %>' />

<asp:TextBox Text ='<%# Eval("City") %>' runat="server" />

<asp:TextBox ID="TextBox134" Text ='<%# CallTest(<%# Eval("City") %>) %>'
runat="server" />

</ItemTemplate>

</asp:TemplateField>

.aspx.cs

public string CallTest(string a)

{

return a;

}
Ganesh - 09 Sep 2007 00:31 GMT
i tried this one too but no luck

<asp:TextBox ID="TextBox134" Text ='<%# CallTest(Eval("SubCity")) %>'
runat="server" />

> Hi There,
>
[quoted text clipped - 29 lines]
>
> }
Eliyahu Goldin - 09 Sep 2007 08:35 GMT
You are using databind expressions. How do you databind?

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

>i tried this one too but no luck
>
[quoted text clipped - 34 lines]
>>
>> }
Ganesh - 09 Sep 2007 10:12 GMT
Is there anyway can i call a function from template field's item template
and assign the value back to text box

Thanks

> You are using databind expressions. How do you databind?
>
[quoted text clipped - 36 lines]
>>>
>>> }
Eliyahu Goldin - 09 Sep 2007 10:22 GMT
Your function will be called during databinding. How do you databind? Do you
set DataSourceID property? Or call DataBind() method? If you do one of them,
it should work. If you do none, it won't.

Signature

Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net

> Is there anyway can i call a function from template field's item template
> and assign the value back to text box
[quoted text clipped - 41 lines]
>>>>
>>>> }
Mark Rae [MVP] - 09 Sep 2007 10:45 GMT
<%#

That's a databinding expression - how are you doing the databinding...?

Signature

Mark Rae
ASP.NET MVP
http://www.markrae.net

Ganesh - 09 Sep 2007 11:48 GMT
Hi

I don't do any data binding, i use asp.net 2.0, when i setup gridview then
assign datasource design time with some query receives some session
variable. when page load automatically it gets data binded.

I try to call a function like this
http://msconline.maconstate.edu/tutorials/ASPNET2/ASPNET07/aspnet07-05.aspx
this is in Binding functions to a GridView listing 7-12. i'm wondering why
it's not working for me.

Thanks

> <%#
>
> That's a databinding expression - how are you doing the databinding...?

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.