|
The DataGridItem was used with the older DataGrid control.
You need to use the following:
foreach (GridViewRow item in DGSample.Rows)
{
}
|
|
|
|
|
hi i want to show my image using binding in a datalist:
<asp:image id="imgMag" width="180" height="85" alternatetext="<%# DataBinder.Eval(Container.DataItem, " title")="" %>"="" xmlns:asp="#unknown">
ImageUrl='<%#GetImgPicUrl(DataBinder.Eval(Container.DataItem, "url"))%>' runat="server" CssClass="newStyle1" />
and :
public string GetImgPicUrl(object url)
{
string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString());
return strUrl;
}
it show image on my pc but on server it dosnt show.
whats problem?
sepel
|
|
|
|
|
Is the picture in the correct location on the server? Check the path you are generating.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
sepel wrote: string strUrl = Server.MapPath(@"~/Attachment/picture/" + url.ToString());
This return a local path as c:\...
What you need is a web url like http://...
Use this:
ImageUrl='<%# Eval("url", "~/Attachment/picture/{0}")%>'
or
ImageUrl='< DataBinder.Eval(Container.DataItem, "url", "~/Attachment/picture/{0}"))%>'
Alexei Rodriguez
|
|
|
|
|
tnx.you are right.
using server.Mappath return local path(e:\...).
sepel
|
|
|
|
|
how to save a attachment in database using file up-loader control. and i have a link button on datagrid on bind time linkbutton show text of the file which we upload from the fileuploader. when i click on this button open that link and save on client computer. may be file will be .rar or .jpg or etc.
plz help me on this topic?
I will do my best?
Integrated Solutions, Bikaner (Raj.), India
|
|
|
|
|
AspDotNetUser wrote: how to save a attachment in database
So is it that or
AspDotNetUser wrote: open that link and save on client computer
Either way, how do YOU think it should be done - after all, you have asked similar questions in the past so you ought to have an idea by now.
Bob
Ashfield Consultants Ltd
|
|
|
|
|
I need to know the current system language ,
I found that code :
Bll.Language.Language.GetSystemLanguage(language);
but i don't know the namespace of Bll
thanks
jooooo
|
|
|
|
|
Hi
The Bll.Language.Language namespace is not part of the .NET framework.
The namespace you are interested in is: System.Globalization.Cultureinfo[^]. There are some good code examples further down that page.
|
|
|
|
|
Please anyone may help!
I am trying a program to send a attachment(only one attachment) to 3 mail recepiants . After sending the mail (a success one) I am finding that the attachment sent to each of the recepient is attached thrice(same file is attached to the mail) whereas I am attaching only a single file.
And more over I am getting the mail twice as if I clicked on the SEND button twice(infact I clicked only once).
Please help me . I give my code as below
thanks in advance
protected void Button1_Click(object sender, EventArgs e)
{
string[] addresses = {"mailaddress1","mailaddress2","mailaddress3" };
SmtpClient smtpMail = new SmtpClient();
smtpMail.Host = "smtp.abc.com";
smtpMail.EnableSsl = true;
MailMessage mail = new MailMessage();
mail.From = new MailAddress("abc@abc.com");
string fileName =
Path.GetFullPath(FileUpload1.PostedFile.FileName);
for (int i = 0; i < addresses.Length; i++)
{
if (FileUpload1.PostedFile != "")
{
try
{
mail.Attachments.Add(new Attachment(fileName));
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
mail.To.Add(addresses[i]);
Response.Write(addresses[i] + " ");
mail.Subject = "HAI!!!!!!!";
mail.Body = "ATTACH TO ALL";
smtpMail.Credentials = new System.Net.NetworkCredential(username.Text, txtPassword.Text);
try
{
smtpMail.Send(mail);
Response.Write(" Mail Sent");
}
catch (Exception ex)
{
Response.Write("Error " + ex.InnerException);
Console.WriteLine(ex.InnerException);
}
}
}//end of event click
Kovuru Sreedhar
|
|
|
|
|
Hi kvsreedhar
The attachment is add 3 time because it is inside the for (int i = 0; i < addresses.Length; i++) block.
If you remove the for loop it will be attached once.
|
|
|
|
|
thanks for your replay
but without using the loop how can i send to 3 persons with just one click?
Kovuru Sreedhar
|
|
|
|
|
You only need to create one MailMessage object, attach the attachment once and send it once.
The only part that needs to be in the for loop is
mail.To.Add(...<code> <br />
<br />
<div class="ForumSig"><a href="http://www.whatUrunning.com">www.whatUrunning.com</a></div>
|
|
|
|
|
thanks a lot it's working.
Kovuru Sreedhar
|
|
|
|
|
You are welcome
|
|
|
|
|
Hi,
when i click the sortoption button in my module
This error will shown : "Failed to compare two elements in the array."
This is my code ascx.cs)
protected void Previous_Routine(object sender, CommandEventArgs e)
{
EgtFlashController objEgtFlashs = new EgtFlashController();
List<egtflashinfo> lstItems = objEgtFlashs.GetEgtFlashs(this.ModuleId);
lstItems.Sort();
int Sorter = 0;
foreach (EgtFlashInfo obj in lstItems)
{
obj.SortId = Sorter;
objEgtFlashs.UpdateEgtFlash(obj);
Sorter++;
}
for (int i = 0; i < lstItems.Count; i++)
{
EgtFlashInfo obj = (EgtFlashInfo)lstItems[i];
if (obj.ItemId == Convert.ToInt32(e.CommandArgument.ToString()))
{
if (i == 0)
{
break;
}
obj.SortId--;
objEgtFlashs.UpdateEgtFlash(obj);
obj = (EgtFlashInfo)lstItems[i - 1];
obj.SortId++;
objEgtFlashs.UpdateEgtFlash(obj);
}
}
//refresh cache
SynchronizeModule();
ExportXml(false);
Response.Redirect(Request.Url.AbsoluteUri, true);
}
This is for design page(.ascx)
<asp:imagebutton imageurl="~/Images/up_arrow.gif" id="BtnPrevious" xmlns:asp="#unknown">
OnCommand="Previous_Routine" CommandName="Previous"
CommandArgument='<%# DataBinder.Eval(Container.DataItem, "ItemId") %>' runat="server"/>
Please tell where i made mistake in my code.
Regards
soona
|
|
|
|
|
here i am using a web application where i wanted to send a word document to the clients when the checkbox control is checked what might be the procedure to attatch a word.doc file and what are the different name spaces used in doing this process
|
|
|
|
|
hi
here i am using a gridview control
binding the data using the dataset in to the gridview control
here after i populate the gridview with the data in the data base, i wanted to add a column which is editable into the same grid into a specified position say column[4] so that i can give some values into the cell and update.
any one who has an thaught about the specified points can help me
|
|
|
|
|
Hi Sumanth,
Create a datatable and set it to dataset.table[0] now add one more column in datatable and bind the gridview with this table.
and for editable value for this column use below..
<asp:TemplateColumn SortExpression="Description" HeaderText="Description">
<HeaderStyle HorizontalAlign="Left" Width="160px" CssClass="grid-header" VerticalAlign="Top"></HeaderStyle>
lt;ItemStyle CssClass="grid-item"></ItemStyle>
<ItemTemplate>
<asp:textbox id=EntryDescription runat="server" CssClass="Standard-text" Width="137px" Text='<%# DataBinder.Eval(Container, "DataItem.Description") %>' MaxLength="250">
</asp:textbox>
</ItemTemplate>
</asp:TemplateColumn>
Thanks
Hem
|
|
|
|
|
Hi I have grid view with a details view binded to it.
I have View details button binded to gridview select property. I also have a add to list button field which should select the current row and insert its certain column to the listbox.
I tried to bind it to select command but its showing the details view also. confused:
Code, Code, Code, chill lol.
|
|
|
|
|
I am developing asp.net application. i have a visual basic exe. when use this exe in asp.net. for the below code
-------------------------------------
Process startinfo = new Process();
startinfo.EnableRaisingEvents = false;
startinfo.StartInfo.FileName = Server.MapPath("~//FolderName\\RR.exe");
startinfo.Start();
--------------------------------------
it is succeffully runing.
when my asp.net web application to run the IIS after publishing. Then that exe not running.
Plz help me. what's probleam.
I have been already full control that folder within store exe.
|
|
|
|
|
Hi Rinki,
If your web application is hosted on Xp machine then give permision to ASPNet user and if it it 2003 server then to the network services.
Let me know if it helps you..
Thanks
Hem
|
|
|
|
|
my applicaion hosted on IIS in xp machine. please tell me clearly that which location of permission to ASPNet user
|
|
|
|
|
is by giving permision to the exe folder to the ASPNET user not working?
|
|
|
|
|