469,361 Members | 2,397 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,361 developers. It's quick & easy.

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 7653
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
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.