473,503 Members | 2,126 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Gridview syntax to code behind

12 New Member
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 7946
prabunewindia
199 New Member
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 New Member
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 New Member
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 New Member
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 New Member
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 New Member
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
5657
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
13725
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
10221
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
1477
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
12723
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
3694
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
2171
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
3516
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
13161
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
1787
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
7205
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7287
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7353
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7011
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5023
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4689
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3170
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
747
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
401
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.