|
Create a textbox, and tie it to a database. On the OnTextChanged event, load the values from the DB using the rowfilter.
|
|
|
|
|
Hi.
I'm usung the below code for generating an image (verification image).
It' OK localy, but when I publish it on server an error appears that says:
"A generic error occurred in GDI+."
code:
System.Drawing.Bitmap image = new System.Drawing.Bitmap(100, 20);
Graphics g = Graphics.FromImage(image);
try
{
Random random = new Random();
g.Clear(Color.WhiteSmoke);
Font font = new System.Drawing.Font("Arial", 14, System.Drawing.FontStyle.Bold);
g.DrawString(checkCode, font, new SolidBrush(Color.Gray), 23, 0);
image.Save(Server.MapPath("Images/" + Session["CheckCode"] + ".gif"), System.Drawing.Imaging.ImageFormat.Gif);
}
finally
{
g.Dispose();
image.Dispose();
}
Best wishes
|
|
|
|
|
Hi
I have the following code which is running on the page load:
ArrayList originalTrue = new ArrayList();
ArrayList originalFalse = new ArrayList();
for (int x = 0; x < GridView4.Rows.Count; x++)
{
GridViewRow row = GridView4.Rows[x];
bool isCheckedIgnore = ((CheckBox)row.FindControl("chkIgnore")).Checked;
string strID = GridView4.DataKeys[x].Values[0].ToString();
if (strID != null)
{
if (isCheckedIgnore == true)
{
originalTrue.Add(strID.ToString());
}
else
{
originalFalse.Add(strID.ToString());
}
}
}
ViewState["originalTrue"] = originalTrue;
ViewState["originalFalse"] = originalFalse;
The problem is when I go to the second page of the gridview it doesnt run.How can I get the code to run on the second page of the gridview?
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
If you have the code in a
if (!IsPostBack)
it will only run when the page loads and not each time there is a post back. Is this the case here?
|
|
|
|
|
Well it currently sits in a ispostback = false.
The problem is that the viewstate seems to keep the state of the page over the postback which I dont want to do.
I need to store the arraylist in some sort of session so that I can check it when the page of the gridview changes. This is because the values it is storing in the viewstate for the row id is then being used when the gridview page changes which obviously is no good.
How can I store the arraylist in a session so that it works over multiple pages in the gridview?
thanks
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
Fixed
The answers posted by me are suggestions only and cannot be used in anyway against me.
|
|
|
|
|
hi friends,
fine and hope u so..
i am trying to include checkbox in the datagrid...
this is my coding
CheckBox chkbox = new CheckBox();
TextBox txtbox= new TextBox();
foreach(DataGridItem item in DGSample.items )
{ chkbox=(CheckBox)item.FindControl("chkbox");
txtbox=(TextBox)item.FindControl("txtbox");
if(chkbox.Checked)
{ Response.Write(item.Cells[0].Text);
}
}
in this coding i am getting probs...in the for loop.....
initially i got error like this...
Error:'System.Web.UI.WebControls.GridView' does not contain a definition for 'items'
so ... i tried with
foreach(DataGridItem item in DGSample.rows )
even i am getting error like
Unable to cast object of type 'System.Web.UI.WebControls.GridViewRow' to type 'System.Web.UI.WebControls.DataGridItem'.
can u anyone help me to solve this prob???
|
|
|
|
|
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
|
|
|
|