Probema com caminho da imagem.
Olá
Estou com problema para salvar as imagens na pasta Thumb424 Thumb65, referente ao video XVII. A criação da pagina inicial do projeto, no caso um dataList.
Esse é o objectdatasource
<asp:ObjectDataSource ID="dsRandom" runat="server"
SelectMethod="SelectProductRandom" TypeName="DevMedia.ECommerce.Product"></asp:ObjectDataSource>
<asp:DataList ID="dtListRandom" runat="server" RepeatColumns="3"
RepeatDirection="Horizontal" DataSourceID="dsRandom">
<ItemTemplate>
<table cellpadding="3" cellspacing="2" style="width: 170px">
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("ImageURL", "images\\Thumb65\\") %>'
PostBackUrl='<%# Eval("ProductID","ShopItem.aspx?ProductID=") %>' /></td>
</tr>
<tr>
<td>
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>'></asp:Label></td>
</tr>
<tr>
<td>
<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price", "{0:C}") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
Fiz uma imagem para ilustar o problema. Estou achando que é apenas problema do caminho da imagem, pois está salvando o endereço da imagem no banco, mais a não está salvando na pasta
Estou com problema para salvar as imagens na pasta Thumb424 Thumb65, referente ao video XVII. A criação da pagina inicial do projeto, no caso um dataList.
Esse é o objectdatasource
<asp:ObjectDataSource ID="dsRandom" runat="server"
SelectMethod="SelectProductRandom" TypeName="DevMedia.ECommerce.Product"></asp:ObjectDataSource>
<asp:DataList ID="dtListRandom" runat="server" RepeatColumns="3"
RepeatDirection="Horizontal" DataSourceID="dsRandom">
<ItemTemplate>
<table cellpadding="3" cellspacing="2" style="width: 170px">
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("ImageURL", "images\\Thumb65\\") %>'
PostBackUrl='<%# Eval("ProductID","ShopItem.aspx?ProductID=") %>' /></td>
</tr>
<tr>
<td>
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>'></asp:Label></td>
</tr>
<tr>
<td>
<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price", "{0:C}") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
Fiz uma imagem para ilustar o problema. Estou achando que é apenas problema do caminho da imagem, pois está salvando o endereço da imagem no banco, mais a não está salvando na pasta
Lorena Menelli
Curtidas 0
Respostas
Lorena Menelli
03/06/2009
Coloquei o projeto no disco..
aqui está o link
https://www.devmedia.com.br/imagens/discovirtual/211069/Hoffmann1.7.rar
Realmente o endereço da imgem está sendo salva no banco de dados, mais a imagem não está sendo salva dentroda pasta Thumb424 eThumb65.
aqui está o link
https://www.devmedia.com.br/imagens/discovirtual/211069/Hoffmann1.7.rar
Realmente o endereço da imgem está sendo salva no banco de dados, mais a imagem não está sendo salva dentroda pasta Thumb424 eThumb65.
GOSTEI 0
Fabio Mans
03/06/2009
Utiliza Server.MapPath("~/Images/Thumb424" + upload.FileName);
GOSTEI 0
Lorena Menelli
03/06/2009
Se for apenas trocar o Server.MapPath("~/images/Thumb424" + upload.FileName); , fiz assim mais não funcionou.
private void saveImage()
{
FileUpload upload = (FileUpload)frmAdd.FindControl("upImage");
String path = Server.MapPath("~/images/Thumb424" + upload.FileName);
if (!File.Exists(path))
{
if (upload.HasFile)
{
// To enable this sample, grant Write permission to the ASP.NET process account
// for the Images subdirectory and uncomment below lines of code.
upload.SaveAs(path);
#region Imagem Maior
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (wi * 140) / he;
CreateThumbnail(140, novaAltura, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 139) / he;
CreateThumbnail(novaLargura, 139, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
#endregion
#region Imagem Menor
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (he * 65) / wi;
CreateThumbnail(65, novaAltura, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 65) / he;
CreateThumbnail(novaLargura, 65, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
#endregion
}
}
}
GOSTEI 0
Fabio Mans
03/06/2009
Você baixou os fontes do projeto?
http://www.mans.com.br/site/DownloadHandler.ashx?pg=9634f906-10aa-4a98-b6e9-1f08554f9379§ion=80a09e5e-8888-481b-a935-d0c0e5adb86f&file=E-Commerce.zip
Perceba que eu faço desta maneira e da certo.
Fabio
http://www.mans.com.br/site/DownloadHandler.ashx?pg=9634f906-10aa-4a98-b6e9-1f08554f9379§ion=80a09e5e-8888-481b-a935-d0c0e5adb86f&file=E-Commerce.zip
Perceba que eu faço desta maneira e da certo.
Fabio
GOSTEI 0
Lorena Menelli
03/06/2009
sim, estou fazendo exatamente com no seu curso.
a questão é que aqui não funciona. Será que pode ser outra coisa? O random está funcionando, o bd tmb.
meu site está nesse diretório, em minha máquina.
D:\Trabalhos\WebSites\Hoffmann1.7.4\Hoffmann1.7.3\Hoffmann1.7
será que isso tem alguma coisa a vê?
o que pode está acontencendo?
a questão é que aqui não funciona. Será que pode ser outra coisa? O random está funcionando, o bd tmb.
meu site está nesse diretório, em minha máquina.
D:\Trabalhos\WebSites\Hoffmann1.7.4\Hoffmann1.7.3\Hoffmann1.7
será que isso tem alguma coisa a vê?
o que pode está acontencendo?
GOSTEI 0
Lorena Menelli
03/06/2009
esse é o html que está retornando ..
<input type="image" name="ctl00$ContentCenter$dtListRandom$ctl01$ImageButton1" id="ctl00_ContentCenter_dtListRandom_ctl01_ImageButton1" src="images\Thumb65\camisasantos.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentCenter$dtListRandom$ctl01$ImageButton1", "", false, "", "ShopItem.aspx?ProductID=61", false, false))" style="border-width:0px;" /></td>
O Problema que quando eu faço upload a imagem não está indo para dentro da pasta Thumb424 Thumb65.
Pelo que eu entendi da sua aula, é salvo apenas o endereço da imagem no banco e a imagem fica salva dentro da pasta.
Depois usar imagebutton pegando o endereço da imagem db e chamar a img da pasta images/Thumb...
na pagina produtos estou chamando o método normalmente..
protected void frmAdd_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
saveImage();
}
novamente o método saveImage
private void saveImage()
{
FileUpload upload = (FileUpload)frmAdd.FindControl("upImage");
String path = Server.MapPath("~/images/" + upload.FileName);
if (!File.Exists(path))
{
if (upload.HasFile)
{
// To enable this sample, grant Write permission to the ASP.NET process account
// for the Images subdirectory and uncomment below lines of code.
upload.SaveAs(path);
#region Imagem Maior
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (wi * 140) / he;
CreateThumbnail(140, novaAltura, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 139) / he;
CreateThumbnail(novaLargura, 139, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
#endregion
#region Imagem Menor
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (he * 65) / wi;
CreateThumbnail(65, novaAltura, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 65) / he;
CreateThumbnail(novaLargura, 65, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
#endregion
}
}
}
public void CreateThumbnail(int largura, int altura, string srcpath, string destpath)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(srcpath);
System.Drawing.Image imgthumb = img.GetThumbnailImage(largura, altura, null, new System.IntPtr(0));
imgthumb.Save(destpath, ImageFormat.Jpeg);
img.Dispose();
imgthumb.Dispose();
}
D:\Trabalhos\WebSites\Hoffmann1.7.4\Hoffmann1.7.3\Hoffmann1.7
Não estou conseguindo resolver, o que vc sugere?
<input type="image" name="ctl00$ContentCenter$dtListRandom$ctl01$ImageButton1" id="ctl00_ContentCenter_dtListRandom_ctl01_ImageButton1" src="images\Thumb65\camisasantos.jpg" onclick="javascript:WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions("ctl00$ContentCenter$dtListRandom$ctl01$ImageButton1", "", false, "", "ShopItem.aspx?ProductID=61", false, false))" style="border-width:0px;" /></td>
O Problema que quando eu faço upload a imagem não está indo para dentro da pasta Thumb424 Thumb65.
Pelo que eu entendi da sua aula, é salvo apenas o endereço da imagem no banco e a imagem fica salva dentro da pasta.
Depois usar imagebutton pegando o endereço da imagem db e chamar a img da pasta images/Thumb...
na pagina produtos estou chamando o método normalmente..
protected void frmAdd_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
saveImage();
}
novamente o método saveImage
private void saveImage()
{
FileUpload upload = (FileUpload)frmAdd.FindControl("upImage");
String path = Server.MapPath("~/images/" + upload.FileName);
if (!File.Exists(path))
{
if (upload.HasFile)
{
// To enable this sample, grant Write permission to the ASP.NET process account
// for the Images subdirectory and uncomment below lines of code.
upload.SaveAs(path);
#region Imagem Maior
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (wi * 140) / he;
CreateThumbnail(140, novaAltura, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 139) / he;
CreateThumbnail(novaLargura, 139, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
#endregion
#region Imagem Menor
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (he * 65) / wi;
CreateThumbnail(65, novaAltura, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 65) / he;
CreateThumbnail(novaLargura, 65, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
#endregion
}
}
}
public void CreateThumbnail(int largura, int altura, string srcpath, string destpath)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(srcpath);
System.Drawing.Image imgthumb = img.GetThumbnailImage(largura, altura, null, new System.IntPtr(0));
imgthumb.Save(destpath, ImageFormat.Jpeg);
img.Dispose();
imgthumb.Dispose();
}
D:\Trabalhos\WebSites\Hoffmann1.7.4\Hoffmann1.7.3\Hoffmann1.7
Não estou conseguindo resolver, o que vc sugere?
GOSTEI 0
Fabio Mans
03/06/2009
Como você está escrevendo na pasta pode ser permissão, você já debugou a aplicação para ver se da erro no momento que vai salvar. Coloque permissão de escrita na pasta que está salvando.
Fabio
Fabio
GOSTEI 0
Lorena Menelli
03/06/2009
Fábio, estava chamando o método no formView errado. Acertei isso e agora está aparecendo o seguinte erro.
Object reference not set to an instance of an object. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Server Error in '/Hoffmann1.7' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 31: FileUpload upload = (FileUpload)frmAdd.FindControl("upImage"); Line 32: Line 33: String path = Server.MapPath("~/images/Thumb424" + upload.FileName); Line 34: Line 35: if (!File.Exists(path))
Object reference not set to an instance of an object. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Server Error in '/Hoffmann1.7' Application. Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 31: FileUpload upload = (FileUpload)frmAdd.FindControl("upImage"); Line 32: Line 33: String path = Server.MapPath("~/images/Thumb424" + upload.FileName); Line 34: Line 35: if (!File.Exists(path))
GOSTEI 0
Lorena Menelli
03/06/2009
Object reference not set to an instance of an object. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } Object reference not set to an instance of an object. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 31: FileUpload upload = (FileUpload)frmAdd.FindControl("upImage"); Line 32: Line 33: String path = Server.MapPath("~/images/" + upload.FileName); Line 34: Line 35: if (!File.Exists(path))
GOSTEI 0
Fabio Mans
03/06/2009
Post o seu aspx
Ele provavelmente não achou o controle upImage
Ele provavelmente não achou o controle upImage
GOSTEI 0
Lorena Menelli
03/06/2009
esse é default.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/Store.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Content ID="Content3" ContentPlaceHolderID="ContentCenter" Runat="Server">
<asp:ObjectDataSource ID="dsRandom" runat="server"
SelectMethod="SelectProductRandom" TypeName="DevMedia.ECommerce.Product"></asp:ObjectDataSource>
<asp:DataList ID="dtListRandom" runat="server" RepeatColumns="3"
RepeatDirection="Horizontal" DataSourceID="dsRandom">
<ItemTemplate>
<table cellpadding="3" cellspacing="2" style="width: 170px">
<tr>
<td>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# Eval("ImageURL", "images\\Thumb65\\") %>'
PostBackUrl='<%# Eval("ProductID","ShopItem.aspx?ProductID=") %>'/></td>
</tr>
<tr>
<td>
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>'></asp:Label></td>
</tr>
<tr>
<td>
<asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price", "{0:C}") %>'></asp:Label></td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</asp:Content>
Esse é o da pg products.aspx
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div class="products_bod2" >
<div class="munu_adminitrador2">
<asp:GridView ID="grdProducts" runat="server" DataSourceID="srcProducts"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None"
onselectedindexchanged="grdProducts_SelectedIndexChanged"
DataKeyNames="ProductID">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="Id"
SortExpression="ProductID" />
<asp:BoundField DataField="Title" HeaderText="Nome"
SortExpression="Title"></asp:BoundField>
<asp:BoundField DataField="Price" HeaderText="Preço"
SortExpression="Price"></asp:BoundField>
<asp:BoundField DataField="CategoryTitle" HeaderText="Categoria"
SortExpression="CategoryTitle" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="alvo2" runat="server" Text="Button" />
</div>
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmAdd" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<div class="backProdutosModalFechar">
<div>
<br />
<asp:Label ID="lblName" Runat="server" AssociatedControlID="txtName"
Text="Nome:" />
<asp:RequiredFieldValidator ID="reqName" Runat="server"
ControlToValidate="txtName" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Digite o nome do produto.</div>
<div>
<asp:TextBox ID="txtName" Runat="server" Text='<%# Bind("Title") %>' />
<br />
<br />
</div>
<div>
<div>
<asp:Label ID="lblDropCategory" Runat="server" AssociatedControlID="drpCat"
Text="Category:" />
</div>
<div>
<div>
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<br />
</div>
<asp:SqlDataSource ID="sqlDsCategory" runat="server"
ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<div>
<br />
</div>
</div>
</div>
<div>
<div>
<asp:Label ID="lblPrice" Runat="server" AssociatedControlID="txtPrice"
Text="Price:" />
<asp:RequiredFieldValidator ID="reqPrice" Runat="server"
ControlToValidate="txtPrice" Display="Dynamic" Text="(Requerido)"
ValidationGroup="Add" />
<asp:CompareValidator ID="valPrice" Runat="server" ControlToValidate="txtPrice"
Display="Dynamic" Operator="DataTypeCheck" Text="(Numérico)" Type="Currency"
ValidationGroup="Add" />
</div>
<div>
Digite o valor do produto</div>
<asp:TextBox ID="txtPrice" Runat="server" Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>' />
</div>
<div>
<asp:Label ID="lblDescription" Runat="server"
AssociatedControlID="txtDescription"
Text="Descrição do produto (aceita HTML):" />
<asp:RequiredFieldValidator ID="reqDescription" Runat="server"
ControlToValidate="txtDescription" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Informe a descrição do produto.</div>
<div>
<asp:TextBox ID="txtDescription" Runat="server" Columns="40" Rows="2"
style="text-align: right" Text='<%#Bind("Description")%>'
TextMode="multiLine" />
<br />
<br />
<asp:Label ID="lblImage" Runat="server" AssociatedControlID="upImage"
Text="Imagem:" />
</div>
<div>
(Opcional)Upload de imagem do disco rígido.
</div>
<div>
<asp:FileUpload ID="upImage" Runat="server" />
<br />
<br />
<asp:Label ID="lblImageAltText" Runat="server"
AssociatedControlID="txtImageAltText" Text="Nome da imagem alterada:" />
</div>
<div>
Digite o nome seguido do tipo da nova imagem:
</div>
<asp:TextBox ID="txtImageAltText" Runat="server" Columns="40"
Text='<%#Bind("ImageUrl")%>' />
<br />
<br />
<asp:Button
id="btnEdit"
Text="Carregar Produto"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancelar"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</div>
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:Panel ID="PnEditProduts2" runat="server" Height="492px" Width="383px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag2" runat="server" Height="560px"
Width="379px">
<div class="backProdutosModalFechar">
<asp:FormView ID="frmAdd2" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserting="frmAdd2_ItemInserting">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
</div>
<cc1:ModalPopupExtender ID="ModalInsert" runat="server"
TargetControlID="alvo2" CancelControlID="btnFechar"
PopupControlID="PnEditProduts2" PopupDragHandleControlID="PnProdutsDrag2"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:ObjectDataSource
id="srcProducts"
TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select"
InsertMethod="Insert"
DeleteMethod="Delete"
OnInserted="srcProducts_Inserted"
Runat="server">
<DeleteParameters>
<asp:Parameter Name="ProductId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="imageURL" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="srcEditProducts" TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select" UpdateMethod="Update" runat="server" OnUpdated="srcEditProducts_Updated"
OnDeleted="srcEditProducts_Deleted">
<UpdateParameters>
<asp:ControlParameter Name="ProductId" ControlID="grdProducts" Type="Int32" />
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="imageUrl" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="grdProducts" Name="ProductId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel Style="display: none" ID="PnUp3" runat="server" Height="133px" Width="241px">
<asp:Panel ID="PnTitulossd" runat="server" Height="122px" Width="232px">
<table border="0" cellpadding="0" cellspacing="0"
style="width: 227px; height: 117px;">
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" Text='<%# Bind("Title") %>' runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="btnEdit0" Text="Update" CommandName="Update" ValidationGroup="Edit"
runat="server" />
<asp:Button ID="btnFechar" runat="server" Text="Fechar" />
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</div>
</asp:Content>
GOSTEI 0
Lorena Menelli
03/06/2009
<asp:FormView ID="frmAdd2" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserting="frmAdd2_ItemInserting">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
GOSTEI 0
Fabio Mans
03/06/2009
Pelo que vi você acrescentou dois Paineis, remova e tente ver se ele acha o controle.
GOSTEI 0
Lorena Menelli
03/06/2009
Ok, deu certo.
Só que a parte de editar a imagem não está funcionando.
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div class="products_bod2" >
<div class="munu_adminitrador2">
<asp:GridView ID="grdProducts" runat="server" DataSourceID="srcProducts"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None"
onselectedindexchanged="grdProducts_SelectedIndexChanged"
DataKeyNames="ProductID">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="Id"
SortExpression="ProductID" />
<asp:BoundField DataField="Title" HeaderText="Nome"
SortExpression="Title"></asp:BoundField>
<asp:BoundField DataField="Price" HeaderText="Preço"
SortExpression="Price"></asp:BoundField>
<asp:BoundField DataField="CategoryTitle" HeaderText="Categoria"
SortExpression="CategoryTitle" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="alvo2" runat="server" Text="Button" />
</div>
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<div class="backProdutosModalFechar">
<div>
<br />
<asp:Label ID="lblName" Runat="server" AssociatedControlID="txtName"
Text="Nome:" />
<asp:RequiredFieldValidator ID="reqName" Runat="server"
ControlToValidate="txtName" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Digite o nome do produto.</div>
<div>
<asp:TextBox ID="txtName" Runat="server" Text='<%# Bind("Title") %>' />
<br />
<br />
</div>
<div>
<div>
<asp:Label ID="lblDropCategory" Runat="server" AssociatedControlID="drpCat"
Text="Category:" />
</div>
<div>
<div>
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<br />
</div>
<asp:SqlDataSource ID="sqlDsCategory" runat="server"
ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<div>
<br />
</div>
</div>
</div>
<div>
<div>
<asp:Label ID="lblPrice" Runat="server" AssociatedControlID="txtPrice"
Text="Price:" />
<asp:RequiredFieldValidator ID="reqPrice" Runat="server"
ControlToValidate="txtPrice" Display="Dynamic" Text="(Requerido)"
ValidationGroup="Add" />
<asp:CompareValidator ID="valPrice" Runat="server" ControlToValidate="txtPrice"
Display="Dynamic" Operator="DataTypeCheck" Text="(Numérico)" Type="Currency"
ValidationGroup="Add" />
</div>
<div>
Digite o valor do produto</div>
<asp:TextBox ID="txtPrice" Runat="server" Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>' />
</div>
<div>
<asp:Label ID="lblDescription" Runat="server"
AssociatedControlID="txtDescription"
Text="Descrição do produto (aceita HTML):" />
<asp:RequiredFieldValidator ID="reqDescription" Runat="server"
ControlToValidate="txtDescription" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Informe a descrição do produto.</div>
<div>
<asp:TextBox ID="txtDescription" Runat="server" Columns="40" Rows="2"
style="text-align: right" Text='<%#Bind("Description")%>'
TextMode="multiLine" />
<br />
<br />
<asp:Label ID="lblImage" Runat="server" AssociatedControlID="upImage"
Text="Imagem:" />
</div>
<div>
(Opcional)Upload de imagem do disco rígido.
</div>
<div>
<asp:FileUpload ID="upImage" Runat="server" />
<br />
<br />
<asp:Label ID="lblImageAltText" Runat="server"
AssociatedControlID="txtImageAltText" Text="Nome da imagem alterada:" />
</div>
<div>
Digite o nome seguido do tipo da nova imagem:
</div>
<asp:TextBox ID="txtImageAltText" Runat="server" Columns="40"
Text='<%#Bind("ImageUrl")%>' />
<br />
<br />
<asp:Button
id="btnEdit"
Text="Carregar Produto"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancelar"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</div>
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:Panel ID="PnEditProduts2" runat="server" Height="492px" Width="383px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag2" runat="server" Height="560px"
Width="379px">
<div class="backProdutosModalFechar">
<asp:FormView ID="frmAdd" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserted="frmAdd_ItemInserted">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
</div>
<cc1:ModalPopupExtender ID="ModalInsert" runat="server"
TargetControlID="alvo2" CancelControlID="btnFechar"
PopupControlID="PnEditProduts2" PopupDragHandleControlID="PnProdutsDrag2"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:ObjectDataSource
id="srcProducts"
TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select"
InsertMethod="Insert"
DeleteMethod="Delete"
OnInserted="srcProducts_Inserted"
Runat="server" onselected="srcProducts_Selected">
<DeleteParameters>
<asp:Parameter Name="ProductId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="imageURL" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="srcEditProducts" TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select" UpdateMethod="Update" runat="server" OnUpdated="srcEditProducts_Updated"
OnDeleted="srcEditProducts_Deleted">
<UpdateParameters>
<asp:ControlParameter Name="ProductId" ControlID="grdProducts" Type="Int32" />
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="imageUrl" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="grdProducts" Name="ProductId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
cs...
protected void Page_Load(object sender, EventArgs e)
{
}
protected void grdProducts_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
grdProducts.DataBind();
}
private void saveImage()
{
FileUpload upload = (FileUpload)frmAdd.FindControl("upImage");
String path = Server.MapPath("~/images/" + upload.FileName);
if (!File.Exists(path))
{
if (upload.HasFile)
{
// To enable this sample, grant Write permission to the ASP.NET process account
// for the Images subdirectory and uncomment below lines of code.
upload.SaveAs(path);
#region Imagem Maior
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (wi * 140) / he;
CreateThumbnail(140, novaAltura, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 139) / he;
CreateThumbnail(novaLargura, 139, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
#endregion
#region Imagem Menor
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (he * 65) / wi;
CreateThumbnail(65, novaAltura, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 65) / he;
CreateThumbnail(novaLargura, 65, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
#endregion
}
}
}
public void CreateThumbnail(int largura, int altura, string srcpath, string destpath)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(srcpath);
System.Drawing.Image imgthumb = img.GetThumbnailImage(largura, altura, null, new System.IntPtr(0));
imgthumb.Save(destpath, ImageFormat.Jpeg);
img.Dispose();
imgthumb.Dispose();
}
protected void grdProducts_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void lnkEdit_Click(object sender, EventArgs e)
{
ModalProdutos.Show();
}
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
protected void frmAdd_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
saveImage();
}
protected void srcProducts_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
{
}
protected void srcProducts_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
}
protected void srcEditProducts_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
grdProducts.DataBind();
}
protected void srcEditProducts_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
{
}
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel Style="display: none" ID="PnUp3" runat="server" Height="133px" Width="241px">
<asp:Panel ID="PnTitulossd" runat="server" Height="122px" Width="232px">
<table border="0" cellpadding="0" cellspacing="0"
style="width: 227px; height: 117px;">
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" Text='<%# Bind("Title") %>' runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="btnEdit0" Text="Update" CommandName="Update" ValidationGroup="Edit"
runat="server" />
<asp:Button ID="btnFechar" runat="server" Text="Fechar" />
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</div>
</asp:Content>
Só que a parte de editar a imagem não está funcionando.
<asp:Content ID="Content4" ContentPlaceHolderID="ContentPlaceHolder2" Runat="Server">
<div class="products_bod2" >
<div class="munu_adminitrador2">
<asp:GridView ID="grdProducts" runat="server" DataSourceID="srcProducts"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None"
onselectedindexchanged="grdProducts_SelectedIndexChanged"
DataKeyNames="ProductID">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="Id"
SortExpression="ProductID" />
<asp:BoundField DataField="Title" HeaderText="Nome"
SortExpression="Title"></asp:BoundField>
<asp:BoundField DataField="Price" HeaderText="Preço"
SortExpression="Price"></asp:BoundField>
<asp:BoundField DataField="CategoryTitle" HeaderText="Categoria"
SortExpression="CategoryTitle" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="alvo2" runat="server" Text="Button" />
</div>
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<div class="backProdutosModalFechar">
<div>
<br />
<asp:Label ID="lblName" Runat="server" AssociatedControlID="txtName"
Text="Nome:" />
<asp:RequiredFieldValidator ID="reqName" Runat="server"
ControlToValidate="txtName" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Digite o nome do produto.</div>
<div>
<asp:TextBox ID="txtName" Runat="server" Text='<%# Bind("Title") %>' />
<br />
<br />
</div>
<div>
<div>
<asp:Label ID="lblDropCategory" Runat="server" AssociatedControlID="drpCat"
Text="Category:" />
</div>
<div>
<div>
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID"
SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<br />
</div>
<asp:SqlDataSource ID="sqlDsCategory" runat="server"
ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<div>
<br />
</div>
</div>
</div>
<div>
<div>
<asp:Label ID="lblPrice" Runat="server" AssociatedControlID="txtPrice"
Text="Price:" />
<asp:RequiredFieldValidator ID="reqPrice" Runat="server"
ControlToValidate="txtPrice" Display="Dynamic" Text="(Requerido)"
ValidationGroup="Add" />
<asp:CompareValidator ID="valPrice" Runat="server" ControlToValidate="txtPrice"
Display="Dynamic" Operator="DataTypeCheck" Text="(Numérico)" Type="Currency"
ValidationGroup="Add" />
</div>
<div>
Digite o valor do produto</div>
<asp:TextBox ID="txtPrice" Runat="server" Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>' />
</div>
<div>
<asp:Label ID="lblDescription" Runat="server"
AssociatedControlID="txtDescription"
Text="Descrição do produto (aceita HTML):" />
<asp:RequiredFieldValidator ID="reqDescription" Runat="server"
ControlToValidate="txtDescription" Text="(Obrigatório)" ValidationGroup="Add" />
</div>
<div>
Informe a descrição do produto.</div>
<div>
<asp:TextBox ID="txtDescription" Runat="server" Columns="40" Rows="2"
style="text-align: right" Text='<%#Bind("Description")%>'
TextMode="multiLine" />
<br />
<br />
<asp:Label ID="lblImage" Runat="server" AssociatedControlID="upImage"
Text="Imagem:" />
</div>
<div>
(Opcional)Upload de imagem do disco rígido.
</div>
<div>
<asp:FileUpload ID="upImage" Runat="server" />
<br />
<br />
<asp:Label ID="lblImageAltText" Runat="server"
AssociatedControlID="txtImageAltText" Text="Nome da imagem alterada:" />
</div>
<div>
Digite o nome seguido do tipo da nova imagem:
</div>
<asp:TextBox ID="txtImageAltText" Runat="server" Columns="40"
Text='<%#Bind("ImageUrl")%>' />
<br />
<br />
<asp:Button
id="btnEdit"
Text="Carregar Produto"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancelar"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</div>
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:Panel ID="PnEditProduts2" runat="server" Height="492px" Width="383px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag2" runat="server" Height="560px"
Width="379px">
<div class="backProdutosModalFechar">
<asp:FormView ID="frmAdd" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserted="frmAdd_ItemInserted">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
</div>
<cc1:ModalPopupExtender ID="ModalInsert" runat="server"
TargetControlID="alvo2" CancelControlID="btnFechar"
PopupControlID="PnEditProduts2" PopupDragHandleControlID="PnProdutsDrag2"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:ObjectDataSource
id="srcProducts"
TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select"
InsertMethod="Insert"
DeleteMethod="Delete"
OnInserted="srcProducts_Inserted"
Runat="server" onselected="srcProducts_Selected">
<DeleteParameters>
<asp:Parameter Name="ProductId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="imageURL" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="srcEditProducts" TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select" UpdateMethod="Update" runat="server" OnUpdated="srcEditProducts_Updated"
OnDeleted="srcEditProducts_Deleted">
<UpdateParameters>
<asp:ControlParameter Name="ProductId" ControlID="grdProducts" Type="Int32" />
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="imageUrl" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="grdProducts" Name="ProductId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
cs...
protected void Page_Load(object sender, EventArgs e)
{
}
protected void grdProducts_RowUpdated(object sender, GridViewUpdatedEventArgs e)
{
grdProducts.DataBind();
}
private void saveImage()
{
FileUpload upload = (FileUpload)frmAdd.FindControl("upImage");
String path = Server.MapPath("~/images/" + upload.FileName);
if (!File.Exists(path))
{
if (upload.HasFile)
{
// To enable this sample, grant Write permission to the ASP.NET process account
// for the Images subdirectory and uncomment below lines of code.
upload.SaveAs(path);
#region Imagem Maior
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (wi * 140) / he;
CreateThumbnail(140, novaAltura, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 139) / he;
CreateThumbnail(novaLargura, 139, path, Server.MapPath("~/images/Thumb424/" + upload.FileName));
}
#endregion
#region Imagem Menor
using (Bitmap bitmap = new Bitmap(upload.PostedFile.InputStream, false))
if (bitmap.Width > bitmap.Height)
{
int wi = bitmap.Width;
int he = bitmap.Height;
int novaAltura = (he * 65) / wi;
CreateThumbnail(65, novaAltura, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
else
{
int he = bitmap.Height;
int wi = bitmap.Width;
int novaLargura = (wi * 65) / he;
CreateThumbnail(novaLargura, 65, path, Server.MapPath("~/images/Thumb65/" + upload.FileName));
}
#endregion
}
}
}
public void CreateThumbnail(int largura, int altura, string srcpath, string destpath)
{
System.Drawing.Image img = System.Drawing.Image.FromFile(srcpath);
System.Drawing.Image imgthumb = img.GetThumbnailImage(largura, altura, null, new System.IntPtr(0));
imgthumb.Save(destpath, ImageFormat.Jpeg);
img.Dispose();
imgthumb.Dispose();
}
protected void grdProducts_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void lnkEdit_Click(object sender, EventArgs e)
{
ModalProdutos.Show();
}
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
protected void frmAdd_ItemInserted(object sender, FormViewInsertedEventArgs e)
{
saveImage();
}
protected void srcProducts_Inserted(object sender, ObjectDataSourceStatusEventArgs e)
{
}
protected void srcProducts_Selected(object sender, ObjectDataSourceStatusEventArgs e)
{
}
protected void srcEditProducts_Updated(object sender, ObjectDataSourceStatusEventArgs e)
{
grdProducts.DataBind();
}
protected void srcEditProducts_Deleted(object sender, ObjectDataSourceStatusEventArgs e)
{
}
}
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel Style="display: none" ID="PnUp3" runat="server" Height="133px" Width="241px">
<asp:Panel ID="PnTitulossd" runat="server" Height="122px" Width="232px">
<table border="0" cellpadding="0" cellspacing="0"
style="width: 227px; height: 117px;">
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" Text='<%# Bind("Title") %>' runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="btnEdit0" Text="Update" CommandName="Update" ValidationGroup="Edit"
runat="server" />
<asp:Button ID="btnFechar" runat="server" Text="Fechar" />
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</div>
</asp:Content>
GOSTEI 0
Fabio Mans
03/06/2009
Perceba que você colocou Painel no editar também.
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
GOSTEI 0
Lorena Menelli
03/06/2009
Sim, mais o que eu não estou endendendo é o seguinte:
Tenho dois ModalPopupExtender, um dentro do painel PnEditProdutos e ou outro dentro do PnEditProdutos2.
Fiz isso pq estou usando dois FormView, um para fazer o insert e ou para edit.
O modal de ID="ModalProdutos" está dentro do painel PnEditProduts que tem dentro um <EditItemTemplate>.
o outro ModalPopupExtender é o ID="ModalInsert" está dentro do Panel com o ID="PnProdutsDrag2".que tem dentro um <InsertItemTemplate>
Há um LinkButton chamdo "add novo protudo" esse chama o insert, abrindo o modal de ID="ModalInsert".
Porem há um evendo click no botão editar que está no TemplateField do GridView que chama o ModalProdutos dinameicamente.
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Como posso chamar duas janelas modal diferentes com um mesmo painel usando ModalPopupExtender?
Tenho dois ModalPopupExtender, um dentro do painel PnEditProdutos e ou outro dentro do PnEditProdutos2.
Fiz isso pq estou usando dois FormView, um para fazer o insert e ou para edit.
O modal de ID="ModalProdutos" está dentro do painel PnEditProduts que tem dentro um <EditItemTemplate>.
o outro ModalPopupExtender é o ID="ModalInsert" está dentro do Panel com o ID="PnProdutsDrag2".que tem dentro um <InsertItemTemplate>
Há um LinkButton chamdo "add novo protudo" esse chama o insert, abrindo o modal de ID="ModalInsert".
Porem há um evendo click no botão editar que está no TemplateField do GridView que chama o ModalProdutos dinameicamente.
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Como posso chamar duas janelas modal diferentes com um mesmo painel usando ModalPopupExtender?
GOSTEI 0
Fabio Mans
03/06/2009
Lorena, sua resposta está no chamado 5607, sobre o mesmo assunto.
https://www.devmedia.com.br/consultoria/viewtopic.asp?id=5607
Fabio
https://www.devmedia.com.br/consultoria/viewtopic.asp?id=5607
Fabio
GOSTEI 0
Lorena Menelli
03/06/2009
Fábio, os modal está funcionando perfeitamente, mais apenas o edite da imagem do db não funciona.
Vc disse que era pq eu estava usando doi painel, mais como fosso usar apenas um painel se eu tenho dois form um para insert eu outro para edite.
Essa é a questão, todas as informações gravadas no db são atualizadas, menos a imagem. Quer dizer o endereço da nova imagem é trocado no banco, apenas a nova imagem não é salva na pasta Thumb.
Vc disse que era pq eu estava usando doi painel, mais como fosso usar apenas um painel se eu tenho dois form um para insert eu outro para edite.
Essa é a questão, todas as informações gravadas no db são atualizadas, menos a imagem. Quer dizer o endereço da nova imagem é trocado no banco, apenas a nova imagem não é salva na pasta Thumb.
GOSTEI 0
Lorena Menelli
03/06/2009
Na hora de editar a imagem, a nova imagem não é salva dentro da pasta Thumb. Mais o endereço da imagem está sendo atualizado dentro do banco normalmente.
<div class="products_bod2" >
<div class="munu_adminitrador2">
<asp:GridView ID="grdProducts" runat="server" DataSourceID="srcProducts"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None"
onselectedindexchanged="grdProducts_SelectedIndexChanged"
DataKeyNames="ProductID">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="Id"
SortExpression="ProductID" />
<asp:BoundField DataField="Title" HeaderText="Nome"
SortExpression="Title"></asp:BoundField>
<asp:BoundField DataField="Price" HeaderText="Preço"
SortExpression="Price"></asp:BoundField>
<asp:BoundField DataField="CategoryTitle" HeaderText="Categoria"
SortExpression="CategoryTitle" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="alvo2" runat="server" Text="Button" />
</div>
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:Panel ID="PnEditProduts2" runat="server" Height="492px" Width="383px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag2" runat="server" Height="560px"
Width="379px">
<div class="backProdutosModalFechar">
<asp:FormView ID="frmAdd" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserted="frmAdd_ItemInserted">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
</div>
<cc1:ModalPopupExtender ID="ModalInsert" runat="server"
TargetControlID="alvo2" CancelControlID="btnFechar"
PopupControlID="PnEditProduts2" PopupDragHandleControlID="PnProdutsDrag2"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:ObjectDataSource
id="srcProducts"
TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select"
InsertMethod="Insert"
DeleteMethod="Delete"
OnInserted="srcProducts_Inserted"
Runat="server">
<DeleteParameters>
<asp:Parameter Name="ProductId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="imageURL" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="srcEditProducts" TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select" UpdateMethod="Update" runat="server" OnUpdated="srcEditProducts_Updated"
OnDeleted="srcEditProducts_Deleted">
<UpdateParameters>
<asp:ControlParameter Name="ProductId" ControlID="grdProducts" Type="Int32" />
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="imageUrl" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="grdProducts" Name="ProductId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel Style="display: none" ID="PnUp3" runat="server" Height="133px" Width="241px">
<asp:Panel ID="PnTitulossd" runat="server" Height="122px" Width="232px">
<table border="0" cellpadding="0" cellspacing="0"
style="width: 227px; height: 117px;">
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" Text='<%# Bind("Title") %>' runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="btnEdit0" Text="Update" CommandName="Update" ValidationGroup="Edit"
runat="server" />
<asp:Button ID="btnFechar" runat="server" Text="Fechar" />
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</div>
</asp:Content>
<div class="products_bod2" >
<div class="munu_adminitrador2">
<asp:GridView ID="grdProducts" runat="server" DataSourceID="srcProducts"
AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
GridLines="None"
onselectedindexchanged="grdProducts_SelectedIndexChanged"
DataKeyNames="ProductID">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="ProductID" HeaderText="Id"
SortExpression="ProductID" />
<asp:BoundField DataField="Title" HeaderText="Nome"
SortExpression="Title"></asp:BoundField>
<asp:BoundField DataField="Price" HeaderText="Preço"
SortExpression="Price"></asp:BoundField>
<asp:BoundField DataField="CategoryTitle" HeaderText="Categoria"
SortExpression="CategoryTitle" />
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:Button ID="alvo2" runat="server" Text="Button" />
</div>
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:Panel ID="PnEditProduts2" runat="server" Height="492px" Width="383px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag2" runat="server" Height="560px"
Width="379px">
<div class="backProdutosModalFechar">
<asp:FormView ID="frmAdd" CssClass="backProdutosModal2" runat="server" DataSourceID="srcProducts"
DefaultMode="Insert" Height="460px" Width="370px"
oniteminserted="frmAdd_ItemInserted">
<InsertItemTemplate>
<asp:Label ID="lblName" Text="Name:" runat="server" AssociatedControlID="txtName" />
<asp:RequiredFieldValidator ID="reqName" ControlToValidate="txtName" Text="(Obrigatório)"
ValidationGroup="Add" runat="server" />
<div class="instructions">
Nome:Digite o nome do produto.
</div>
<asp:TextBox ID="txtName" Text='<%# Bind("Title") %>' runat="server" /> <br />
<br />
<asp:Label ID="lblCategory" Text="Categegoria:" runat="server"
AssociatedControlID="drpCategory" />
<asp:RequiredFieldValidator ID="reqCategory" runat="server" ControlToValidate="drpCategory"
ErrorMessage="(Obrigatorio)" InitialValue="Choose a category"
ValidationGroup="Add" />
<div class="instructions">
Selecione a categoria.<br />
<asp:DropDownList ID="drpCategory" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>' AppendDataBoundItems="True">
<asp:ListItem Selected="True">Categorias</asp:ListItem>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
</div>
<br />
<asp:Label ID="lblPrice" Text="Price:" runat="server" AssociatedControlID="txtPrice" />
<asp:RequiredFieldValidator ID="reqPrice" ControlToValidate="txtPrice" Text="(Required)"
Display="Dynamic" ValidationGroup="Add" runat="server" />
<asp:CompareValidator ID="valPrice" ControlToValidate="txtPrice" Text="(Currency)"
Operator="DataTypeCheck" Type="Currency" ValidationGroup="Add" Display="Dynamic"
runat="server" />
<div class="instructions">
Digite o preço do produto.
</div>
<asp:TextBox ID="txtPrice" Columns="5" Text='<%# Bind("Price") %>' runat="server" />
<br style="clear: both" />
<br />
<asp:Label ID="lblDescription" Text="Digite uma descrição (aceita HTML):" AssociatedControlID="txtDescription"
runat="server" />
<asp:RequiredFieldValidator ID="reqDescription" ControlToValidate="txtDescription"
Text="(Required)" ValidationGroup="Add" runat="server" />
<div>
Descrição do produto.
</div>
<asp:TextBox ID="txtDescription" Text='<%#Bind("Description")%>' TextMode="multiLine"
Columns="40" Rows="2" runat="server" /> <br />
<br />
<br />
<asp:Label ID="lblImage" Text="Image:" AssociatedControlID="upImage" runat="server" />
<asp:RequiredFieldValidator ID="reqImage" runat="server" ControlToValidate="upImage"
ValidationGroup="Add">(Obrigatório)</asp:RequiredFieldValidator><div class="instructions">
(Opicional)Carregar imagem do disco rígido.
</div>
<asp:FileUpload ID="upImage" runat="server" FileName='<%# Bind("ImageURL") %>' /> <br />
<div>
</div>
<br />
<asp:Button ID="btnAdd" Text="Add Product" CommandName="Insert" ValidationGroup="Add"
runat="server" />
<asp:Button ID="btnCancel" Text="Cancel" CausesValidation="false" CommandName="Cancel"
runat="server" />
</InsertItemTemplate>
</asp:FormView>
</div>
<cc1:ModalPopupExtender ID="ModalInsert" runat="server"
TargetControlID="alvo2" CancelControlID="btnFechar"
PopupControlID="PnEditProduts2" PopupDragHandleControlID="PnProdutsDrag2"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
<asp:ObjectDataSource
id="srcProducts"
TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select"
InsertMethod="Insert"
DeleteMethod="Delete"
OnInserted="srcProducts_Inserted"
Runat="server">
<DeleteParameters>
<asp:Parameter Name="ProductId" Type="Int32" />
</DeleteParameters>
<InsertParameters>
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="imageURL" Type="String" />
</InsertParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="srcEditProducts" TypeName="DevMedia.ECommerce.Product"
SelectMethod="Select" UpdateMethod="Update" runat="server" OnUpdated="srcEditProducts_Updated"
OnDeleted="srcEditProducts_Deleted">
<UpdateParameters>
<asp:ControlParameter Name="ProductId" ControlID="grdProducts" Type="Int32" />
<asp:Parameter Name="categoryId" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
<asp:Parameter Name="description" Type="String" />
<asp:Parameter Name="imageUrl" Type="String" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="grdProducts" Name="ProductId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Panel Style="display: none" ID="PnUp3" runat="server" Height="133px" Width="241px">
<asp:Panel ID="PnTitulossd" runat="server" Height="122px" Width="232px">
<table border="0" cellpadding="0" cellspacing="0"
style="width: 227px; height: 117px;">
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" Text='<%# Bind("Title") %>' runat="server"></asp:TextBox>
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
<asp:Button ID="btnEdit0" Text="Update" CommandName="Update" ValidationGroup="Edit"
runat="server" />
<asp:Button ID="btnFechar" runat="server" Text="Fechar" />
</td>
<td class="style3">
</td>
</tr>
<tr>
<td class="style1">
</td>
<td class="style2">
</td>
<td class="style3">
</td>
</tr>
</table>
</asp:Panel>
</asp:Panel>
</div>
</asp:Content>
GOSTEI 0
Fabio Mans
03/06/2009
Na inclusão funciona? Faça igual a inclusão, debug e programa que você descobre o erro.
Fabio
GOSTEI 0
Lorena Menelli
03/06/2009
Então, a questão é essa, não aparece o erro.
A inclusão(add imagem) de uma nova imagem, funciona perfeitamente. O endereço e salvo no bancom e a imagem dentro da Pasta Thumb.
O problema está na hora de salvar a nova imagem na pasta(Insert).
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
----------------------------------------------------------------------------------------------------------------------------
<!--esse modal está sendo chamado pelo evento do botão que está dentro do gridView-->
arquivo cs ....
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Grid
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
-------------------------------------------------------------------------------------------------------------------------
Estou desconfiada que pode ser alguma coisa com o evento lnkEdit_Click1. VOU TENTAR MUDAR PARA CHAMAR DE UM LINKBUTTON. Não aparece erro em nada, muito estranho. ..
A inclusão(add imagem) de uma nova imagem, funciona perfeitamente. O endereço e salvo no bancom e a imagem dentro da Pasta Thumb.
O problema está na hora de salvar a nova imagem na pasta(Insert).
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
----------------------------------------------------------------------------------------------------------------------------
<!--esse modal está sendo chamado pelo evento do botão que está dentro do gridView-->
arquivo cs ....
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Grid
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
-------------------------------------------------------------------------------------------------------------------------
Estou desconfiada que pode ser alguma coisa com o evento lnkEdit_Click1. VOU TENTAR MUDAR PARA CHAMAR DE UM LINKBUTTON. Não aparece erro em nada, muito estranho. ..
GOSTEI 0
Lorena Menelli
03/06/2009
Então, a questão é essa, não aparece o erro.
A inclusão(add imagem) de uma nova imagem, funciona perfeitamente. O endereço e salvo no bancom e a imagem dentro da Pasta Thumb.
O problema está na hora de salvar a nova imagem na pasta(Insert).
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
----------------------------------------------------------------------------------------------------------------------------
<!--esse modal está sendo chamado pelo evento do botão que está dentro do gridView-->
arquivo cs ....
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Grid
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
-------------------------------------------------------------------------------------------------------------------------
Estou desconfiada que pode ser alguma coisa com o evento lnkEdit_Click1. VOU TENTAR MUDAR PARA CHAMAR DE UM LINKBUTTON. Não aparece erro em nada, muito estranho... O que vc acho que poder ser?
A inclusão(add imagem) de uma nova imagem, funciona perfeitamente. O endereço e salvo no bancom e a imagem dentro da Pasta Thumb.
O problema está na hora de salvar a nova imagem na pasta(Insert).
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:FormView ID="frmEdit" CssClass="backProdutosModal" runat="server" DataSourceID="srcEditProducts"
DefaultMode="Edit" oniteminserted="frmAdd_ItemInserted" Height="497px" Width="370px">
<EditItemTemplate>
<asp:Label
id="lblName"
Text="Name:"
AssociatedControlID="txtName"
Runat="server" />
<asp:RequiredFieldValidator
id="reqName"
ControlToValidate="txtName"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
Enter the name of the product.
</div>
<asp:TextBox
id="txtName"
Text='<%# Bind("Title") %>'
Runat="server" /> <br /><br />
<div class="colForm">
<asp:Label
id="lblDropCategory"
Text="Category:"
AssociatedControlID="drpCat"
Runat="server" />
<div class="instructions">
Select a product category.
<br />
<asp:DropDownList ID="drpCat" runat="server" DataSourceID="sqlDsCategory"
DataTextField="Title" DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
</asp:DropDownList>
<asp:SqlDataSource ID="sqlDsCategory" runat="server" ConnectionString="<%$ ConnectionStrings:StoreString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Hof_Categories] ORDER BY [Title]">
</asp:SqlDataSource>
<br />
<br />
</div>
</div>
<div class="colForm">
<asp:Label
id="lblPrice"
Text="Price:"
AssociatedControlID="txtPrice"
Runat="server" />
<asp:RequiredFieldValidator
id="reqPrice"
ControlToValidate="txtPrice"
Text="(Required)"
Display="Dynamic"
ValidationGroup="Add"
Runat="server" />
<asp:CompareValidator
id="valPrice"
ControlToValidate="txtPrice"
Text="(Currency)"
Operator="DataTypeCheck"
Type="Currency"
ValidationGroup="Add"
Display="Dynamic"
Runat="server" />
<div class="instructions">
Enter the product price.
</div>
<asp:TextBox
id="txtPrice"
Columns="5"
Text='<%# Bind("Price", "{0:0.00}") %>'
Runat="server" />
</div>
<br style="clear:both" /><br />
<asp:Label
id="lblDescription"
Text="Brief Description (can include HTML):"
AssociatedControlID="txtDescription"
Runat="server" />
<asp:RequiredFieldValidator
id="reqDescription"
ControlToValidate="txtDescription"
Text="(Required)"
ValidationGroup="Add"
Runat="server" />
<div class="instructions">
The brief description appears in the Products.aspx
page and in advertisements.
</div>
<asp:TextBox
id="txtDescription"
Text='<%#Bind("Description")%>'
TextMode="multiLine"
Columns="40"
Rows="2"
Runat="server" /> <br />
<br /><br />
<asp:Label
id="lblImage"
Text="Image:"
AssociatedControlID="upImage"
Runat="server" />
<div class="instructions">
(Optional)Upload a product image from your hard drive.
</div>
<asp:FileUpload
id="upImage"
Runat="server" />
<br /><br />
<asp:Label
id="lblImageAltText"
Text="Image Alt Text:"
AssociatedControlID="txtImageAltText"
Runat="server" />
<div class="instructions">
Alternate text associated with the product image.
</div>
<asp:TextBox
id="txtImageAltText"
Text='<%#Bind("ImageUrl")%>'
Columns="40"
Runat="server" />
<br /><br />
<asp:Button
id="btnEdit"
Text="Update Product"
CommandName="Update"
ValidationGroup="Edit"
Runat="server" />
<asp:Button
id="btnCancel"
Text="Cancel"
CausesValidation="false"
CommandName="Cancel"
Runat="server" />
</EditItemTemplate>
</asp:FormView>
<asp:LinkButton ID="alvo1" Style="display: none" runat="server">LinkButton</asp:LinkButton>
<cc1:ModalPopupExtender ID="ModalProdutos" runat="server"
TargetControlID="alvo1" CancelControlID="btnFechar"
PopupControlID="PnEditProduts" PopupDragHandleControlID="PnProdutsDrag"
RepositionMode="RepositionOnWindowResize"
OnOkScript="onOk()" X="-1"
Y="-1" Enabled="True" Drag="True"
BackgroundCssClass="modalBackgroundProdutos">
</cc1:ModalPopupExtender>
</asp:Panel>
</asp:Panel>
----------------------------------------------------------------------------------------------------------------------------
<!--esse modal está sendo chamado pelo evento do botão que está dentro do gridView-->
arquivo cs ....
protected void lnkEdit_Click1(object sender, EventArgs e)
{
ModalProdutos.Show();
}
Grid
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton
id="lnkEdit"
Text="Edit"
CommandName="Select"
Runat="server" onclick="lnkEdit_Click1" />
/
<asp:LinkButton
id="lnkDelete"
Text="Delete"
CommandName="Delete"
OnClientClick="return confirm('Are you sure that you want to delete this product?')"
Runat="server" />
</ItemTemplate>
</asp:TemplateField>
-------------------------------------------------------------------------------------------------------------------------
Estou desconfiada que pode ser alguma coisa com o evento lnkEdit_Click1. VOU TENTAR MUDAR PARA CHAMAR DE UM LINKBUTTON. Não aparece erro em nada, muito estranho... O que vc acho que poder ser?
GOSTEI 0
Fabio Mans
03/06/2009
Faz um favor, remove o painel temporariamente e tente ver se salva.
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
<asp:Panel ID="PnEditProduts" runat="server" Height="560px" Width="371px"
style="margin-right: 0px">
<asp:Panel ID="PnProdutsDrag" runat="server" Height="560px"
Width="379px">
GOSTEI 0
Lorena Menelli
03/06/2009
Fabio, era o que vc tinha dito mesmo, não estava encontrado o caminho da imagem" pq eu estava fazedno Bind no banco com o nome minusculo ImageUrl e no db estava ImageURL.
que coisa em..
Mais uma etapa vencida.. valeww.. Ufa .....espero que no meu segundo projeto eu esteja mais esperta..
obrigada.. xau .. pode fechar..
que coisa em..
Mais uma etapa vencida.. valeww.. Ufa .....espero que no meu segundo projeto eu esteja mais esperta..
obrigada.. xau .. pode fechar..
GOSTEI 0