Modal popup with gridview row detail

Hi! I've show many example but I don't know how to apply solutions to my 
code: I've a gridview with a list of records, I'd like using a detail 
button, open an ajax modal popup with the detail (for update) of the row 
selected

<asp:GridView ID="gvElencoAttivita" runat="server" 
AutoGenerateColumns="False" DataKeyNames="Id" 
onrowdatabound="gvElencoAttivita_RowDataBound"
ShowFooter="true" AllowSorting="True" CellPadding="8" GridLines="Vertical">
         <Columns>
             <asp:TemplateField HeaderText="" ItemStyle-Width="30">
                 <ItemTemplate>
                     <asp:Button ID="btnCancella" 
OnClick="btnCancellaAttivita_Click" IDRiga='<%# Eval("ID") %>' 
runat="Server" CausesValidation="False" Text="Cancella" Width="60px" 
OnClientClick="return confirm('Cancellare la riga selezionata?');" /> 

                  </ItemTemplate>
             <ItemStyle Width="30px"></ItemStyle>
             </asp:TemplateField>
             <asp:BoundField DataField="DescrizioneAttivita" 
HeaderText="Descrizione attività" SortExpression="DescrizioneAttivita"/>
             <asp:TemplateField HeaderText="DateApp">
                 <ItemTemplate>
                     <asp:Label ID="lblDateApp" runat="server" Text='<%# 
Eval("DateApp") %>'></asp:Label>
                 </ItemTemplate>
             <ItemStyle Width="150px"></ItemStyle>
             </asp:TemplateField>

        </Columns>

     </asp:GridView>
0
roberta
5/11/2010 8:06:05 AM
dotnet.framework.aspnet 1423 articles. 0 followers. Follow

1 Replies
1458 Views

Similar Articles

[PageSpeed] 2

On May 11, 10:06=A0am, roberta <r...@tis.it> wrote:
> Hi! I've show many example but I don't know how to apply solutions to my
> code: I've a gridview with a list of records, I'd like using a detail
> button, open an ajax modal popup with the detail (for update) of the row
> selected
>
> <asp:GridView ID=3D"gvElencoAttivita" runat=3D"server"
> AutoGenerateColumns=3D"False" DataKeyNames=3D"Id"
> onrowdatabound=3D"gvElencoAttivita_RowDataBound"
> ShowFooter=3D"true" AllowSorting=3D"True" CellPadding=3D"8" GridLines=3D"=
Vertical">
> =A0 =A0 =A0 =A0 =A0<Columns>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0<asp:TemplateField HeaderText=3D"" ItemStyle-W=
idth=3D"30">
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<ItemTemplate>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<asp:Button ID=3D"btnCancella"
> OnClick=3D"btnCancellaAttivita_Click" IDRiga=3D'<%# Eval("ID") %>'
> runat=3D"Server" CausesValidation=3D"False" Text=3D"Cancella" Width=3D"60=
px"
> OnClientClick=3D"return confirm('Cancellare la riga selezionata?');" />
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 </ItemTemplate>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0<ItemStyle Width=3D"30px"></ItemStyle>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0</asp:TemplateField>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0<asp:BoundField DataField=3D"DescrizioneAttivi=
ta"
> HeaderText=3D"Descrizione attivit=E0" SortExpression=3D"DescrizioneAttivi=
ta"/>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0<asp:TemplateField HeaderText=3D"DateApp">
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<ItemTemplate>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0<asp:Label ID=3D"lblDateApp" r=
unat=3D"server" Text=3D'<%#
> Eval("DateApp") %>'></asp:Label>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0</ItemTemplate>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0<ItemStyle Width=3D"150px"></ItemStyle>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0</asp:TemplateField>
>
> =A0 =A0 =A0 =A0 </Columns>
>
> =A0 =A0 =A0</asp:GridView>


You need to get the gridviewrow from the sender to get the datakey

For example

protected void LinkButton_Click(object sender, EventArgs e)
{
LinkButton MyLink =3D sender as LinkButton;
GridViewRow row =3D (GridViewRow)MyLink.NamingContainer;
int id =3D (int)this.PMAGrid.DataKeys[row.RowIndex].Value;
....
// show the modal popup
this.mdlPopup.Show();

where mdlPopup is a name of your ModalPopupExtender
0
Alexey
5/16/2010 5:10:17 PM
Reply:

Similar Artilces:

How do I pivot a range of cells, i.e. from column to row?
How do I pivot/transpose the data from a range of cells from, say, a column to a row? I imagine it should be very simple, but I haven't found out how yet. For instance: row# 1 data 1 2 data 2 3 data 3 4 data 4 to column# 1 2 3 4 data1 data2 data3 data4 ...

Javascript to retrieve Gridview cell text
This is a Label in ItemTemplate i wish to use javascript to put <%# Eval("Organization") %> in a textbox How can i take the text value of <%# Eval("Organization") %>? put this - onmousedown="alert(<%# Eval("�ӽо��c") %>)" ??? thanks for any ideas? *********************** <asp:Label ID="Label11" runat="server" Text='<%# Eval("Organization") %>' ></asp:Label> &nbsp;<asp:Label ID="Label2" runat="server" Text='<%# Eval("Depart...

Merging rows
office 2003 excel How can I merge two rows into one row? Also... where is that in help? I spent about 45 minutes trying to find it. Thanks John if you want to merge A1:A10 and B1:B10, select C1:C10 and type in C1 =A1&B1 and ctrl+enter. Neo Cheung wrote: > if you want to merge A1:A10 and B1:B10, select C1:C10 and type in C1 > =A1&B1 and ctrl+enter. > Thanks... works great. Now, how do I get it to be just the data and not the reference to the other rows. thanks John Hi John, To eliminate the formula leaving only the value --- select column C, Ctrl+C (edit, copy), ...

Hide/Delete entire rows based in the content of one cell
Hello all. I have a spreadsheet that is over 500 rows long. As it is I have no use for all of the rows at the same time and have to keep hiding and showing them as need arises. Is there a macro to hide chunks of it based on the value of one cell of the row? In other words, en each row I will have a formula like =if(a1=0,"HIDE","") and this value will tell the macro wether to hide the row or not. I tried case.select but it takes a LONG time and I would have to write a piece of code for every line. FYI, the rows that need hiding will be in sequence, in other words, fro...

Auto height rows
I am working in Excel 2000 for Windows with cells that are NOT merged. The individual cells have varying amounts of data (anywhere from a few characters to over 1000 characters). All text is wrapped. When I double click on the row to auto height, it adjusts the height but the printed version still cuts off text. In most cases the row height does not come anywhere near 409.5 pixels. I saw the problem with bottom aligned text, but all my cells are top aligned. I am working with 19 files that include at least four worksheets with 300+ rows of data. It's getting time consuming to re...

Detailed COM Interface error
I am using .net C# to call a third party application to edit a .xml file. This is the error the third party application return when I tried to save after edit. Unalble to save: failure writing new data to object tree. Detailed COM Interface error: 80004005 Then I tried to directly run the third party app to save the .xml but it returns me the same error as aboved. So I suspect the problem due to the ..xml file itself. This is the line that caused the error: <PCInterface xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instanc...

Why have I got some repeating rows after a Excel 2003 sort
I copied and sorted an existing worksheet which had been obtained from an unknown source. I found some of the rows were duplicated after the sort, but with the number column showing different results from the original row and not formatted. The original worksheet had no duplicates. Why would this happen? I have used older versions of Excel for years and this has never happened before. Hi jayne are you sure there were no hidden rows in the original data? Cheers JulieD "Jayne" <Jayne@discussions.microsoft.com> wrote in message news:D5C7F6BE-EE34-434A-B829-68B2FA6C4AD2@...

Showing a modal dialog AFTER my SDI app is visible.
Hi, I want to show a modal dialog immediatly after my SDI formview app has become visible. (at startup) (without having to press a button first). I mean i want to show a login dialog immediatly after the app. becomes active. If i do DoModal() for the login dialog somewhere in my code like in OnInitialUpdate(), the dialog appeares before the rest of the app is visible. You could set a timer at the end of OnInitialUpdate() that fires say, 1/2 second later and have it pop up the dialog and kill the timer. Tom "RAN" <nijenhuis@wish.nl> wrote in message news:1187720799.182448...

I need excel to only use the last 26 rows in a chart
I have a large spreadsheet that has data in it that is entered weekly. I would like for the chart to grab the most recent 26 weeks of data automatically. Does anyone know of a formula that will do this? Logan: If you haven't already, you may want to establish dynamic ranges for your data set. This will allow you to automatically update your chart(s) as new data is entered It will also allow you to plot the last number of days/weeks that you want. This post explains how to set up dynamic range names and plot user specified number of days. It should get you started on dynamic range ...

Every Other Row
Is there a way to get Excel to calculate Standard Deviation on every other row (there are 2400 rows, so manually putting them in isn't really an option.) ** Posted via: http://www.ozgrid.com Excel Templates, Training, Add-ins & Software! Free Support at http://www.ozgrid.com/forum/ ** One way to try .. Assume the source data is in A1:A2400 in Sheet1 In a new Sheet2 ----------------------- Put in A1: =OFFSET(Sheet1!$A$1,ROW(A1)*2-2,) Copy A1 down to A1200 This'll extract every other row from Sheet1's A1:A2400 (i.e. from Sheet1's A1, A3, A7, A9, ... A2399) Then just put...

make row height a little bigger in a wrapped cell
I've got a sheet with columns at work date text (sometimes multi-line wrapped) $ nnnn.nn I can wrap text no problem but I hope approximate double spacing so I don't have to put a blank row between each item. I need the space between items so the text isn't squashed all together for a court form I guess I want to be able to say height of cell necessary for the wrapped text however much it might be plus n for each row height. I can't find a way. Is it possible? Excel 2002 Win xp Thanks for your help. If you're using merged cells, then this w...

Rows and Columns
I am using Excel XP Each worksheet has 65,536 rows and 256 columns according to specifications. Is there a way to change these number to a smaller amount? I know I can hide rows and columns, but wondering if I can not have them to start them. TIA Bill The short answer is NO. Just don't format more than you need. -- Don Guillett SalesAid Software donaldb@281.com "EZDOIT" <Please@smile.com> wrote in message news:dxupc.98556$Ik.7697285@attbi_s53... > I am using Excel XP > > Each worksheet has 65,536 rows and 256 columns according to specifications. > >...

adding rows #2
How do I add rows without changing cell location in the formula. For example: The data for the formula is always located in cell B4 and if I add a row on top of B4, I want the formula to remain with B4. Right now, if I add a row, the cell in the formula goes down one row. Hope for help If I understand, you're adding a row higher than B4. This shifts B4 down, but you want the "new" B4 to be the data for the formula. If this is the case you could try this: =formula(OFFSET(A1,3,1,1,1)) That is, as long as you don't add a new top row. ...

Need help formatting rows
Hello everyone, I am using excel 2007 I would like to know how to do the following if possible have column A add column B and put the total in column C and then put the amount of column C in column A of the next row. EX: 1+1=2 in row 1 then automatically have it put 2 in row 2 column A Thanks in advance if anyone can help. Bobby Cell C1: = +A1 + B1 Cell A2: = +C1 -- Hope this helps. If it does, please click the Yes button. Thanks in advance for your feedback. Gary Brown "bobby02169" wrote: > Hello everyone, > I am using excel 2...

Crosstab Row Heading Issues
Hi, I have Access 2003 and when I do a cross tab I cannot bring in more than 3 field values for row headings - my coworker (who has Access 97) can bring in >3 row headings. Is this a paremter setting in Access 2003? Thanks, Mike I believe that the Wizard can't handle more than 3; however, you can do more with SQL. Try creating a crosstab with the three headings, them modifying it at SQL level to add more. -- Jerry Whittle, Microsoft Access MVP Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder. "mike" wrote: > Hi, > > I have Access 2003 and...

Can Excel sort rows by color?
I want to sort a spreadsheet by the color of the rows. Here's a website that will help you accomplish this: http://www.cpearson.com/excel/SortByColor.htm tj "Grant" wrote: > I want to sort a spreadsheet by the color of the rows. Grant, have a look here http://www.cpearson.com/excel/SortByColor.htm -- Paul B Always backup your data before trying something new Please post any response to the newsgroups so others can benefit from it Feedback on answers is always appreciated! Using Excel 2002 & 2003 "Grant" <Grant@discussions.microsoft.com> wrote in mes...

format group of rows based on condition
I've seen answers to similar problems, but nothing as complex as this: I have the following set-up (simplified) Type City Store actual Portland TB bid Portland TB actual Memphis AU bid Memphis AU bid Memphis AU I need to format in VBA (since this is over 3000 rows deep), in the following manner: Insert a row in between a change in the cities column. Then surround the grouping by city with a bold outline. Color the row with the bid gray and color the rows in between the cities blue. The sheet has...

highlight consecutive duplicate rows (re-sending)
My apologies if anyone responded to this when I originally posted. I didn't download enough headers and I can't recapture the original.... I want to highlight any row that has the same data as the previous row. For example, if A:3=A:2 and B:3=B:2 and C:3=C:2, I want to highlight Row 3. I also want to repeat this logic throughout the spreadsheet. Can I do with this with Conditional Formatting? Or, would I need to use VBA...in which case, how would I code this? Thanks in advance. I have no idea if anyone responded to your earlier post, but you could check yourself: You can ...

Project Acc Detail Trial Bal Report doesn't show Project Data?
Hi, We've upgraded GP8 PA to GP9, and one difference is Purchasing using POP. For Purchasing expenses prior to our GP9 upgrade, this TB report shows Project data when selecting Document Detail. I.e. when running it currently, for transactions dated after our GP9 upgrade it doesn’t, and trx dated before the upgrade it does show Project data. I’ve traced the SQL activity during the Report run, and found it queries tables: 1. GL20000 for GL Journals 2. PA31102 for PO Rcpt Line History (legacy table shows valid Project No’s) 3. POP30310 also for PO Rcpt Line History (POP table includes Pr...

repeat rows at top
Once you've created your "standard" colum headings, how do you repeat them on every page --- Message posted from http://www.ExcelForum.com/ "al_rwli >" <<al_rwli.zrrq5@excelforum-nospam.com> wrote in message news:al_rwli.zrrq5@excelforum-nospam.com... > Once you've created your "standard" colum headings, how do you repeat > them on every page File > Page Setup > Sheet tab Print titles: Rows to repeat at top File>page setup>sheet and put the reference in rows to repeat at top -- Regards, Peo Sjoblom "al_rwli ...

Sum Function Without Including Hidden Rows?
I'm using Excel 2000 and have *hidden* several rows that include numeric data. I want to do a sum function on some of the columns intersecting those rows, but when I insert an AutoSum function, it includes data in the visible rows AND the hidden rows. Is there an easy way to perform a sum function that *only* includes the rows that are *-visible?-* (Which rows are hidden/visible are subject to constant change) Thanks for your help! --- Message posted from http://www.ExcelForum.com/ You would need a UDF for that or if there is a pattern (like if every other column/row is hidden) th...

Advanced Sorting (4000 rows) followup Q.
Green John blue cats $50.00 Happy Green 2 John blue cats $50.00 Green 2 blue John cats $50.00 Green 2 blue cats John $50.00 Green 2 blue cats $50.00 John What I want: For example, I want "John" to be sorted to the first column for each row. Problem: In my original table, there are over 20+ Columns and 4,000 rows. Sorting by row, three at at time would take forever, especially since I have over 100 different databases that I need to do this on. Without sorting by rows three at a time, what's the best solution? If there's no way to do this in excel without a t...

Problems inserting rows
How can I insert a row in Excel when the assistant says it's not possible? The assistant says that inserting rows would shift data off the worksheet, rather into the next blank rows Maybe... XL: "Cannot Shift Objects Off Sheet" Error Hiding Columns http://support.microsoft.com/default.aspx?scid=kb;en-ca;211769 Remember to look for comments and merged cells. KathleenK wrote: > > How can I insert a row in Excel when the assistant says it's not possible? > The assistant says that inserting rows would shift data off the worksheet, > rather into the next blan...

Copy & Paste lost row heights
I have three price list spreadsheets that I want to combine into one All of the layout column widths are the same as are the row heights However when I try to copy and paste one price list onto the bottom o another all of the row heights are lost and the product images that inserted alongside each description are banked up one after the other Paste special may be the answer but I cannot find the answer if ther is one. There is a lot of work in resetting row heights nad movin images so if there is a way of pasting exactly what I see on the scree on one spreadsheet into another spreadsheet the...

VBA to adjust Row Height
I am new to writing VBA and I am having trouble writing code that achieves the following: If text in D2>115 characters then adjust row D's height to 30, else row height remains 20 followed by the same if then statment for rows E thru M (i.e., If M2>115 Then Row M height = 30 Any suggestions would be greatly appreciated. Hi Bob you are tlaking about columns but you want to change the row height? I asume you're talking about row 2 (in your example?). Note you can't change the heigth of a row individually per column. If you change it it will apply for all columns. So maybe ...