472,122 Members | 1,451 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,122 software developers and data experts.

Gridview syntax to code behind

12
Hey, can anyone give newbie a tip on how to call function to get value to CommandField's edittext property.

<%="test"%> is not working or '<%="test"%>' and so on..
May 28 '07 #1
6 7780
prabunewindia
199 100+
hi friend,

to call a funtion in html page,

call like this,
<%# function()%>
declare this function as public one in code behind
Hey, can anyone give newbie a tip on how to call function to get value to CommandField's edittext property.

<%="test"%> is not working or '<%="test"%>' and so on..
May 28 '07 #2
jph
12
hi friend,

to call a funtion in html page,

call like this,
<%# function()%>
declare this function as public one in code behind
Thanks for quick reply m8 :)

Tried similar earlier aswell but i get following parser error:
Parser Error Message: Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.CommandField does not have a DataBinding event.

Heres html side from gridview
<asp:CommandField ShowEditButton="True" EditText='<%#getEditText()%>' UpdateText='upd' CancelText='canc'></asp:CommandField>
May 28 '07 #3
prabunewindia
199 100+
ohh..
thats for command field!!?
sorry.
u can try by code your funtion in the RowCreated or rowCommand event of the gridView
i did the same in one of my project. but i user Datagrid, it having event called ItemCreated..... you try with the grid view, if not then come to datagrid

try and reply(if u have time)
Prabu


Thanks for quick reply m8 :)

Tried similar earlier aswell but i get following parser error:
Parser Error Message: Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.CommandField does not have a DataBinding event.

Heres html side from gridview
<asp:CommandField ShowEditButton="True" EditText='<%#getEditText()%>' UpdateText='upd' CancelText='canc'></asp:CommandField>
May 28 '07 #4
jph
12
ohh..
thats for command field!!?
sorry.
u can try by code your funtion in the RowCreated or rowCommand event of the gridView
i did the same in one of my project. but i user Datagrid, it having event called ItemCreated..... you try with the grid view, if not then come to datagrid

try and reply(if u have time)
Prabu
Found a way to work around it, just converted commandfield to templatefield and then in text properties function calls work.
May 28 '07 #5
prabunewindia
199 100+
hi friend,
plz send me those codings and html
Prabu

Found a way to work around it, just converted commandfield to templatefield and then in text properties function calls work.
May 28 '07 #6
jph
12
hi friend,
plz send me those codings and html
Prabu
Well code generated to grid inside columns tag is just simply:

<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"
Text='<%# GetText("Update") %>'></asp:LinkButton>
<asp:LinkButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"
Text='<%# GetText("Cancel") %>'></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Edit"
Text='<%# GetText("Edit") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
May 28 '07 #7

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

3 posts views Thread by NateDawg | last post: by
reply views Thread by Eiriken | last post: by
3 posts views Thread by Dorte | last post: by
2 posts views Thread by Steve | last post: by
2 posts views Thread by luisxx | last post: by
1 post views Thread by jmdolinger | last post: by
2 posts views Thread by antonyliu2002 | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.