473,804 Members | 3,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

link data grid edit button

Hello,

In Visual studio .NET 2003,

On datagrid object :
How can I link the button element : edit, to do a some client events (such
as message box,
and do another event just after that to the server (do some manipulation on
the database).

If I cannot - how can I do that anyway in some tricky way ?

Thanks :)

Nov 19 '05
13 1424
Ignore the last,

I found it (itemIndex = -1, and that's why controls.count = 0),
so I add in the code :
If e.Item.ItemInde x <> -1 Then ...

Another thing is that I see that the page is refreshing (page_load event
occurs),
but the command editBtn.Attribu tes.Add("Onclic k", "Alert('Edi t Message')")
is not doing anything.
(There is no message box).
Why ?

Thanks :)
Nov 19 '05 #11
did you mean : new web user control ?

Thanks :)

"Yunus Emre ALPÖZEN [MCAD.NET]" <ye***@msakadem ik.net> wrote in message
news:e%******** ********@TK2MSF TNGP10.phx.gbl. ..
New Web Control Library

--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET

"John M" <nobody@nospam_ please.com> wrote in message
news:OA******** ******@TK2MSFTN GP14.phx.gbl...
... and how can I make a web-control library (file - > new ??? ... )

Thanks :)

"Yunus Emre ALPÖZEN [MCAD.NET]" <ye***@msakadem ik.net> wrote in message
news:eB******** ******@TK2MSFTN GP09.phx.gbl...
There is no limit in programming:)))

Create a web control library named as MyControlLibrar y and following
code... And use this control in anywhere... Feel free to built on
something on this....

using System;
using System.Web.UI;
using System.Web.UI.W ebControls;

namespace MyControlLibrar y
{
[System.Componen tModel.DefaultP roperty("Text") ,
ToolboxData("<{ 0}:MyLinkButton runat=server></{0}:MyLinkButto n>")]
public class MyLinkButton : System.Web.UI.W ebControls.Link Button
{
string question="?";
[System.Componen tModel.Bindable (true)]
public String Question
{
get
{
return question;
}
set
{
question="";
}
}
protected override void Render(HtmlText Writer output)
{
Attributes.Add( "onClick",Strin g.Format("javas cript:return
confirm('{0}')" ,Question));
base.Render(out put);
}
}
}
--

Thanks,
Yunus Emre ALPÖZEN
BSc, MCAD.NET

"John M" <nobody@nospam_ please.com> wrote in message
news:OR******** ******@TK2MSFTN GP15.phx.gbl...
Hello,

In Visual studio .NET 2003,

On datagrid object :
How can I link the button element : edit, to do a some client events
(such
as message box,
and do another event just after that to the server (do some
manipulation on
the database).

If I cannot - how can I do that anyway in some tricky way ?

Thanks :)




Nov 19 '05 #12
Thank you Elton W.
Thank you Yunus Emre.

I combine your both replies :
The line I correct is :
editBtn.Attribu tes.Add("onclic k", String.Format(" alert(""abc"")" ))

(Adding string.format ...)

(The another thing is that page need to reload on every click)

But now Everything works fine ...
Thanks :)
Nov 19 '05 #13
itemIndex = -1 means ListItemType.He ader.

So you have to use

If e.Item.ItemType = ListItemType.It em OrElse e.Item.ItemType =
ListItemType.It em = ListItemType.Al ternatingItem Then

rather than

If e.Item.ItemType = ListItemType.It em OrElse ListItemType.Al ternatingItem
Then

That condition will bypass Header, Footer, Separator, Pager items.

HTH

Elton



"John M" wrote:
Ignore the last,

I found it (itemIndex = -1, and that's why controls.count = 0),
so I add in the code :
If e.Item.ItemInde x <> -1 Then ...

Another thing is that I see that the page is refreshing (page_load event
occurs),
but the command editBtn.Attribu tes.Add("Onclic k", "Alert('Edi t Message')")
is not doing anything.
(There is no message box).
Why ?

Thanks :)

Nov 19 '05 #14

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2224
by: pmud | last post by:
Hi, I have a web page (asp.net, code:c#). I havean html table with text boxes. Based on the user input , records are displayed in the data grid below it. Now the datagrid has a large no. of columns. & depending on what the user enters, the data grid can grow very large. So to avoid scrolling the whole page, I just want the data grid to be scrollable. For this I used the <div> tags around the data grid, <div...
5
2797
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
2
2986
by: Remy | last post by:
Hi I would like to put a link into the Footer of the first column of an ASP.NET 2.0 GridView. By first column I mean the column where it normally displayes the Edit and Delete link. I've built the Insert functionality into the footer, but I only wanna display those controls if someone clicks on the link. At the moment I hide the whole footer and I have the link outside of the grid. I guess I could just add another table below the grid...
10
2934
by: Corey B | last post by:
I have a data grid that has three columns: First Name, Middle Name, and Last Name. The grid has a list of people with a blank row at the bottom of the grid (in the footer) that allows the user to add a new person to the list. There is also an Edit button at the end of each row that allows the user to edit a particular row. So far - no problem - easy to do. I have been asked to make the grid section 508 compliant. The requirement is...
0
1424
by: anwarulhuq | last post by:
I have placed Edit-Update-Cancel Link button from Properties builder of the Data Grid. Its working but the problem what im facing is.. It doesnt work till i click for two times. Link button should work for only one click right. Please help me out to solve this.
2
1489
by: Bazza Formez | last post by:
Hello, In my aspx file I have a LinkButton inside a template column, inside a datagrid. I have assigned a CommandName to the button. In my code behind, I attempt to trap the command in the ItemCooamd for the Datagrid. I have used this successfully before with no problems. This time however, the button will not fire ItemCommand.
3
2343
by: kevinpublic | last post by:
I have an item list for ordered products on a data grid in VS 2003. It's an ASP page running VB behind it. All detail lines display as well as all shipping charges. On the edit screen, we allow them to cancel individual line items. We have the 'Cancel' button enabled for the line items of the datagrid. However, I would like to hide that button for the shipping charges. We don't want them cancelling their shipping fees, after all. ...
1
1415
by: rktester | last post by:
Hi, I am trying to implement an editable datagrid in .net 2005 This is how my grid is defined: <asp:DataGrid runat="server" id="dgUser" Font-Name="Verdana" Font-Size="9pt" CellPadding="5" AlternatingItemStyle-BackColor="#dddddd" AutoGenerateColumns="False" DataKeyField="UserId"
0
1050
by: ravindarjobs | last post by:
hello friends, i am using vb6. i am using a datagrid on my form. i am showing a table data in that grid. i have enabled the grid property " allow to add new rows" and" allow edit" here are my few doubts and requirements 1. there will be an empty row shown at the last row by default. when we insert data in to that row, another empty row will automatically created. my requirement is such that, when new row comes automatically, its...
0
9706
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10580
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10082
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7621
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6854
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5525
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5652
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4301
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
3
2993
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.