473,246 Members | 1,424 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,246 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 7935
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

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

Similar topics

3
by: theKirk | last post by:
using Visual Studio 2005 C# ASP.NET I know there has to be a simple way to do this....I want to use C# in a code behind for aspx. Populate a GridView from an xml file Add Fields to the...
3
by: NateDawg | last post by:
I'm reposting this. I'm kinda in a bind untill i get this figured out, so if anyone has some input it would sure help me out. Ok, I’ve noticed a few gridview problems floating around the forum....
28
by: Tim_Mac | last post by:
hi, i'm new to .net 2.0, and am just starting to get to grips with the gridview. my page has autoEventWireUp set to true, which i gather is supposed to figure out which handlers to invoke when...
0
by: Eiriken | last post by:
Hello everyone, I am using ASP.NET 2 and trying to bind a objectdatasource to a gridview. By doing this the most common way by adding an objectdatasource to the page and by using the wizard to...
3
by: Dorte | last post by:
Hi, Could someone help me with a couple of links to SqlDatasource documentation on how to use the Gridview and SqlDatasource components in code behind? Basically I'm missing some documentation...
2
by: Steve | last post by:
One of the columns in my gridview is a blank textbox (I have added it as a template field). Users can enter a number in the textbox for a multiple of the gridview records. I have a submit button...
2
by: luisxx | last post by:
WinSrv2003 SP1 IIS 6.0 ASP.NET C#, 2.0 SQL 2005 All on same machine Hello everyone! I have a method in ASP.NET 2.0 that I can't seem to get right, Gridview1_rowcommand.
1
by: jmdolinger | last post by:
Hi all, I'm a newbie to Atlas (and recently ASP.NET) after coming from a long Java background, also have done quite a bit with an Ajax.NET/ASP.NET 1.1 project, but it was basically all...
2
by: antonyliu2002 | last post by:
I've been googling for some time, and could not find the solution to this problem. I am testing the paging feature of gridview. I have a very simple web form on which the user can select a few...
1
by: pieandpeas | last post by:
he selectedindex of my gridview is always one behind for example, if i click on the EDIT.gif on row 1, then 5 , then 7, if i break the code and check the selectedindex, it is equal to 5. if i...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, youll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.