How to display a client-side confirm dialog box if the user clicks on the first row in my datagrid

I could n implement that, this what I tried:

I define my datagrid with :  <ItemTemplate> <a id="MenuItem".......><%#container............>  pls check my aspx html code bellow.

Thn, In the ItemDataBound event handler of my datagrid, I test if

e.Item.ItemIndex=0, if so, I create an object of type control and assign it to e.item.controls(0) , then I try to add the client side property: atributes(....) to that control.

The pb is: the control object that I create doesn t take the client property :  attributes(“onclick”)=….

My question is:  What type are my <a href …> tags and how can I refer to them in  my code behind. How can I create a control that I assign to that tag so that I can add the attributes(“onclick”) property. What type is it gonna be behind the code?

  <%@ Control Language="vb" AutoEventWireup="false" Codebehind="MenuLeft.ascx.vb" Inherits="WebApplication3.Menu_Left" TargetSchema="" %>

<asp:datagrid BorderWidth="0" GridLines="None" CellSpacing="10" id="dgMenuLeft" Height="0" AutoGenerateColumns="False"

            Runat="server" ShowHeader="False">

            <AlternatingItemStyle VerticalAlign="Top"></AlternatingItemStyle>




                                        <a id="MenuItem" href='Matrix_portal.aspx?command=<%#container.dataitem("menuURL")%>'>







thanks a lot for your help

Thanks a lot, I appreciate your taking the time to help me.
6/20/2006 2:27:13 PM 24353 articles. 2 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 13
Get it on Google Play
Get it on Apple App Store

you just need to find the control on eact data bound item.

Check this article for help


If you need more help shout

SteveF MCP
.Net Consultant
6/20/2006 2:53:32 PM
thanks a lot

Thanks a lot, I appreciate your taking the time to help me.
6/22/2006 2:57:55 PM
I built a LinkButton buttoncolumn instead of <a...>  tag
then I do in Mydatagrid.itemdatabound handler: 
if e.itemindex=0 then
ctype(e.item.cells(0).controls(0),LinkButton).attributes("onclick")= "confirm return('do u want to confirm?');"

Thanks a lot, I appreciate your taking the time to help me.
6/30/2006 9:23:06 PM

Similar Artilces:

Perform JavaScript Client Side Confirmation from a VB.NET DataGrid
Hi, I when I delete an item from the database through a Datagrid I want to get a messagebox popingup to give me the choise to Confirm case I clicked the wrong item....the way it works now it just deletes it....can any one help me with an Example I have no Idea how to do this...I found an article in C# but it didnt help me at all. here is my source code <asp:DataGrid ID="dgCustList" Runat="server" AutoGenerateColumns="False" DataKeyField="id" AlternatingItemStyle-BackColor="#F6F6F6" HeaderStyle-BackColor="#C4B58E" CellSpacing="0" CellPadding="2" GridLines="Vertical" Width="100%"...

(CLIENT SIDE DATAGRID SEARCHING) Javascript code needed to scroll a scrollable datagrid to a specific row in datagrid?
I have a page that has a datagrid within a 'div' element, so that the datagrid is scrollable. Also, on the same page, I have a 'Search' button that searches the 'Invoice Number' column for an invoice number equal to the  value entered by the user in a textbox with id 'txtSearch'. Though I am able to find the invoice number and highlight its row using javascript, how can I make the scroll bar of div move vertically down to the position of the highlighted row of the datagrid using client side code?sun21170 Hello sun, i've never tried this, and don't know if there'...

first client side after goes to server side
Hello, how are you guys? Going crazy doing development? Me too. But perhaps you could save me to the sanatorium :p. Well, my case is the following. I trying to put a button that his first event occur in local machine and the second event pass trough server, depending on client option  In my case, a register that can be deleted, which if the client want to delete the register, he clicks the link and shows a dialog box asking if he really wants to delete it, and depending if he clicks “ok” or “cancel” the register is deleted or not. In datagrid is easy to do because you just instantiate t...

List of client side function of extenders and controls for client side
Hello All,I am using AJAX control toolkit for my current project. Now I need to find out what client side functions I can call on an extender. Lets say I am using a PopControlExtender. Now I want to show the popup from a JS funtions.If I can do a guess then it would be something like this$find('ppce').show();From where I can find what client side functions I can call on those extensders. This is really a frusterating thing. I learn about extenders only from Learn tutorials, no help here and there. Can anybody please tell me where are documentations about all the extenders in the tool...

client side sort and server side sort in the same datagrid
Hi,Can i do client side sort and server side sort in the same datagrid? and by parametet decise which sort to activate?Thanks I wouldn't suggest it as a client-side sort is going to be 1. hard to create and implement, 2. almost impossible to retain values across PostBacks, and 3. slow.NC... thanks....

client side table rows not showing up server side?
so my code is something like... <updatepanel><submit button><updatepanel> <div><table><row><cell><Table id="mytable" runat="server"><thead><thead><tbody>...I create client side rows here</tbody>.....<div> so I add a bunch of rows client side...input some data... and then click submit.  However, when I look at the contents of Me.myTable on the server...I only see my 2 static header rows?  I've tried adding the runat attribute to the client side rows ....still didn't work.&nb...

Validation Controls in .NET ( Client side or server side?)
 i have a very basic question. We have all these validation controls in ( required field, range validator and others) question is the required field validator is a server side control. So does that mean that it does a post back? it client side or server side control  The only controls that post back are buttons and other inputs where you set AutoPostback="True", such as a dropdownlist or a textbox.  Another way of posting back is using an UpdatePanel and placing a trigger in it for a specified control and/or event. All controls are considered clien...

Jscript, moving from client-side to server-side (.NET)
Hey all I’m working translating a web-app written in client-side Jscript to run on the server-side as JScript.NET. Without needing to get too specific, I am using Jscript because the original page aggregated raw data to produce statistical results (this was done dynamically based on user 'sort-by' options). The final output is an html report that can be emailed. Because this is currently being done on the client side, as the raw data grows the load-time grows as well (to the point that has almost become unusable). I’m posting here to see if anyone has any experi...

Adding Row in Datagrid in client side
Hi! Can anyone help me how i'm goin to add row in DataGrid dynamically using javascript in client side? for instance..i have add button on my page..if i press or click the add button (client side) a new row will be added in my datagrid. Thanks Once the code of your page is compiled, it is outputted as HTML and the page cannot be compiled again unless it is posted back to the server. Since ASP.NET is completely server side, it cannot in any way communicate with a a client script such as JavaScript. I suppose you could add the row with some dynamic HTML, but then you'd have to ...

How to display message box at client side?
hi there, Can any body help me out to display a message box in If so pls send me how to do it. It may be easy but I want to know how . thanks Regards, DeadRocker I use this function: public void ClientMessageBox( string message ) { Page.RegisterStartupScript( "alert", "<script>alert('" + message + "');</script>" ); } Niall...

displaying client side message box
i want to dispaly the system.Windows.Forms.MessageBox in the client side computer.. i try this code but when i excute it, i is displaying in server not in the client computer how am i going to do this. thanks in advance What kind of application are we talking about? Where is the code located? BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and He will give you your heart's desires" (Psalm 37: 3-4). like this im using i want to execute function. ex. public sub save() ...

DataGrid Row selection at client side
I have a Datagrid and i need a functionality to set the row of a datagrid to a color(blue) when i click on the DataGrid row. I have a check box in the DataGrid Header if i select the checkbox all the rows in the datagrid are set with the color(blue) at client side. i wrote the code but it is giving problems. can you pls help me out in solving this problem. code is below: var selectedRow = null; function fnSelectRow(rowObject) {         if (selectedRow != null)         {                 selected...

When to use client side varidation and server side varidation in .net?
In .net or classic web application we can varidate user data either on client isde or server side. How to select which side varidate to be used? Thanks! Generally, I use both client and server validation. I make sure the input is in the correct format and reasonably valid on the client, then I verify the data on the server. The extent of validation also depends on the type of data that I need to validate.Here are a few references:Validating ASP.NET Server ControlsIntroduction to Validating User Input in Web FormsClient-Side Validation for ASP.NET Server ControlsSecurity Checklist...

Can i run an EXE on server side to be displayed on client side?
I have made an animation in VB(file.exe), its a bit like a screen buddy that walks about the screen. I can call it from ASP. Dim WshShell set WshShell = CreateObject("WScript.Shell") WshShell.Run "C:\WINDOWS\Desktop\file.exe" set WshShell= nothing %> where the file.exe is on my desktop. Does the client side see the animation? If not is there any way for the client to see this? I understand there are security issues here, but i only want this screen buddy to be displayed on their browser or screen. Java isn't an option as i don't have time to lear...