473,569 Members | 2,590 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 7948
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.W ebControls.Comm andField does not have a DataBinding event.

Heres html side from gridview
<asp:CommandFie ld ShowEditButton= "True" EditText='<%#ge tEditText()%>' UpdateText='upd ' CancelText='can c'></asp:CommandFiel d>
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.W ebControls.Comm andField does not have a DataBinding event.

Heres html side from gridview
<asp:CommandFie ld ShowEditButton= "True" EditText='<%#ge tEditText()%>' UpdateText='upd ' CancelText='can c'></asp:CommandFiel d>
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:TemplateFi eld ShowHeader="Fal se">
<EditItemTempla te>
<asp:LinkButt on ID="LinkButton1 " runat="server" CausesValidatio n="True" CommandName="Up date"
Text='<%# GetText("Update ") %>'></asp:LinkButton>
<asp:LinkButt on ID="LinkButton2 " runat="server" CausesValidatio n="False" CommandName="Ca ncel"
Text='<%# GetText("Cancel ") %>'></asp:LinkButton>
</EditItemTemplat e>
<ItemTemplate >
<asp:LinkButt on ID="LinkButton1 " runat="server" CausesValidatio n="False" CommandName="Ed it"
Text='<%# GetText("Edit") %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateFie ld>
May 28 '07 #7

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

Similar topics

3
5666
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 GridView to allow entry of quantity and Y/N switch for
3
13730
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. Everyone wants to do a java confirmation box when a user clicks the delete button. Fair enough, basic user design rules state that you should...
28
10234
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 appropriate based on your method names . the GridView has OnRowCommand="GridView1_RowCommand" in the aspx. my problem is that the RowCommand event...
0
1485
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 connect to my business logic everything works fine. The problem is that I find this quite limited and I need to do some custom work with the...
3
12727
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 on how to handle different tasks programmatically such as selects, updates, sorting of data etc. in code behind if I prefer to set all Gridview and...
2
3696
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 which is intended to use code behind to access these textbox values and eventually add them to a database. However, I can't seem to loop through...
2
2179
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
3519
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 javascript, nothing really having to do with ASP.NET... I'm attempting to put together an application that consists of several GridView controls each...
2
13168
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 fields to be included in the table, which is to be bound to the gridview. The web form looks like so (Don't worry about the stupidity of this web...
1
1795
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 selected a different row, and then checked the selectedindex again, it would be equal to 7. i've checked a few posts and other people seem to have a...
0
7615
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7924
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8130
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7677
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7979
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5514
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3643
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2115
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.