Ci riprovo GridView con apertura finestre...

martedì 16 gennaio 2007 - 18.15

squilibrio Profilo | Expert

Ciao a tutti, ho fatto mille ricerche googlando ma non ho trovato nessun
esempio da cui partire per per fare in modo che cliccando su un
elemento di un gridview (o su un pulsante presente in ogni riga), venga
aperta una "finestra/area" su un livello superiore, come visualizzato in
questo link... (disabilitando la pagina in background)

http://ajax.asp.net/ajaxtoolkit/Animation/Animation.aspx


Spero che qualche anima gentile mi aiuti....

Thanks

Brainkiller Profilo | Guru

>Ciao a tutti, ho fatto mille ricerche googlando ma non ho trovato
>nessun esempio da cui partire per per fare in modo che cliccando su
>un elemento di un gridview (o su un pulsante presente in ogni riga),
>venga aperta una "finestra/area" su un livello superiore, come visualizzato

Veramente la tua descrizione assomiglia di più a questo controllo:
http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx
che a quello che hai indicato tu.
Sbaglio ?


David De Giacomi | Microsoft MVP
http://blogs.dotnethell.it/david/

squilibrio Profilo | Expert

E' perfetto... ma avevo già trovato esempi di questo tipo, quello che non riesco a capire/fare è come applicarli in una GridView che visualizzi in una "finestra modale" il dettaglio dell'elemento (riga) selezionato dal GridView... potreste darmi un aiuto?

Grazie infinite per l'aiuto

squilibrio Profilo | Expert

Mi sono bloccato a questo punto: cliccando su edit di ogni elemento non so come visualizzare gli elementi della riga selezionata

per quale motivo?? Dove sbaglio?

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addpost.aspx.cs" Inherits="_Default" %>
<%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI" TagPrefix="asp" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>


<script runat="server">
protected void cancelButton_Click(object sender, EventArgs e)
{
title.Text = String.Empty;
summary.Text = String.Empty;
post.Text = String.Empty;
}
protected void submitAdd_Click(object sender, EventArgs e)
{
....
}
private void onEditButton(object sender, EventArgs e)
{

GridViewRow row = GridView1.SelectedRow;
//TextBox2.Text = row.Cells[1].Text;
ModalPopupExtender1.Show();
}

</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<style type="text/css">
.background{
background-color: gray;
filter:alpha(opacity=70);
opacity:0.7;
}
</Style>
<title>Add Post-Beta</title>
</head>
<body>

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
<cc1:AnimationExtender ID="AnimationExtender1" runat="server" TargetControlID="addPostButton">
<Animations>
<OnClick>
<Parallel AnimationTarget="addPostDiv" Duration=".3" Fps="30">
<FadeIn />
<Resize Height="350"/>
</Parallel>
</OnClick>
</Animations>
</cc1:AnimationExtender>

<div>
<div style="margin-bottom: 4px;">
<div style="border: dashed 1px blue;">
<div id="addPostDiv" style="background-color:#990099;overflow:hidden; height:0px;">
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table>
<tr>
<td style="width: 7763px">
<asp:Label ID="Label1" runat="server" Text="Title"></asp:Label>
</td>
<td style="width: 99px">
<asp:TextBox ID="title" runat="server" Width="415px"></asp:TextBox></td>
<td style="width: 17562px">
</td>
</tr>
<tr>
<td style="width: 7763px; height: 34px;">
<asp:Label ID="Label2" runat="server" Text="Summary"></asp:Label></td>
<td style="width: 99px; height: 34px;">
<asp:TextBox ID="summary" runat="server" TextMode="MultiLine" Height="114px" Width="415px"></asp:TextBox></td>
<td style="width: 17562px; height: 34px;">
</td>
</tr>
<tr>
<td style="width: 7763px; height: 96px;">
<asp:Label ID="Label3" runat="server" Text="Post"></asp:Label></td>
<td style="width: 99px; height: 96px;">
<asp:TextBox ID="post" runat="server" TextMode="MultiLine" Height="133px" Width="417px"></asp:TextBox></td>
<td style="width: 17562px; height: 96px;">
</td>
</tr>
<tr>
<td style="width: 7763px">
</td>
<td style="width: 99px">
<asp:Button ID="submitAdd" runat="server" Text="Add Post" OnClick="submitAdd_Click" />
<asp:Button ID="cancelButton" runat="server" BorderStyle="Groove" OnClick="cancelButton_Click"
Text="Cancel" /></td>
<td style="width: 17562px">
</td>
</tr>
<tr>
<td style="width: 7763px; height: 11px;">
</td>
<td style="width: 99px; height: 11px;">
&nbsp;</td>
<td style="width: 17562px; height: 11px;">
</td>
</tr>
</table>

<cc1:AnimationExtender ID="SubmitPostButtonAnimation" runat="server" TargetControlID="submitAdd">
<Animations>
<OnClick>
<Parallel AnimationTarget="addPostDiv" Duration=".3" Fps="30">
<FadeOut />
<Resize Height="0"/>
</Parallel>
</OnClick>
</Animations>
</cc1:AnimationExtender>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger EventName="Click" ControlID="submitAdd" />
<asp:AsyncPostBackTrigger EventName="Click" ControlID="addPostButton" />
</Triggers>


</asp:UpdatePanel>
</div>
</div>
</div>

<asp:Button ID="addPostButton" runat="server" Text="Add a New Post" OnClick="addPostButton_Click" /><br />
<asp:UpdateProgress ID="ModalUpdateProgress1" runat="server">
<ProgressTemplate>
<div class="modalPopup" style="background-position: center center; z-index: 1; background-repeat: no-repeat; background-color: orange; left: 6px; width: 925px; top: 5px; height: 28px; position: relative;">
Loading....
<img src="Images/indicator.gif" align="middle" /><br />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">

<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
DataKeyNames="ID" DataSourceID="SqlDataSource1" ForeColor="#333333" GridLines="None" AllowPaging="True" PageSize="7" OnSelectedIndexChanged="onEditButton">


<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<Columns>

<asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True"
SortExpression="ID" />
<asp:BoundField DataField="IDMittente" HeaderText="IDMittente" SortExpression="IDMittente" />
<asp:BoundField DataField="Oggetto" HeaderText="Oggetto" SortExpression="Oggetto" />
<asp:TemplateField>
<ItemTemplate>
<asp:linkButton ID="HyperLink1" runat="server" Font-Underline="false" ToolTip="Ana are mere"
Text="Edit" OnCommand="onEditButton" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<RowStyle BackColor="#E3EAEB" />
<EditRowStyle BackColor="#7C6F57" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SNX %>"
SelectCommand="SELECT * FROM [MailBox]"></asp:SqlDataSource>
</ContentTemplate>

</asp:UpdatePanel>
<asp:Button ID="FakeButton" runat="server" Style="display:none;" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="fakeButton" PopupControlID="Panel1" BackgroundCssClass="background" CancelControlID="Button2" OkControlID="Button1" OnOkScript="onOk()" DropShadow="true">
</cc1:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" Height="327px" Width="657px" style="display:none; vertical-align: middle; background-color: cornsilk; text-align: center;">
<br />
Title:
<br />
<asp:TextBox ID="TextBox2" runat="server" Height="20px" Width="387px"></asp:TextBox><br />
post:<br />
<asp:TextBox ID="TextBox1" runat="server" Height="147px" Width="393px"></asp:TextBox><br />
&nbsp;<br />

<asp:Button ID="Button1" runat="server" Text="Update" />

<asp:Button ID="Button2" runat="server" Text="Cancel" /></asp:Panel>
</div>
</form>
</body>

squilibrio Profilo | Expert

Please help me!!!
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5