|
HI!
I have one quite short question. Does anybody know how instruct an update panel to update its context, without assigning a server side control(asp:Button) to do that.
|
|
|
|
|
You mean updating every an interval time?
<< >>
|
|
|
|
|
I need to do the following. Using ajax.net i create HttpRequest to the server, but with the difference that if server has no data for the client, the connection is not closed, but it is kept open. So when the data for the client arrives, the server can forward the data to the client. The data is just an id of the update panel that needs to update its content. So when the data arrives I need to instruct the specified update panel to update its content.
|
|
|
|
|
Hi
I currently have a form for people to fill in, with this they need to uplaod a profile picture of themselves. At the moment I have the following code which uploads the image, but i want to be able to resize the image to a certin size. Ive seen resizing help on the web, but most of these seem to be large/thumbnail codes and im getting a bit boggled!
Boolean fileOK = false;
String path = Server.MapPath("~/uploadedconsultantimages/");
if (UploadImage.HasFile)
{
String fileExtension =
System.IO.Path.GetExtension(UploadImage.FileName).ToLower();
String[] allowedExtensions =
{ ".gif", ".png", ".jpeg", ".jpg" };
for (int i = 0; i < allowedExtensions.Length; i++)
{
if (fileExtension == allowedExtensions[i])
{
fileOK = true;
}
}
}
if (fileOK)
{
try
{
UploadImage.PostedFile.SaveAs(path
+ UploadImage.FileName);
FileUploaded.Text = "File uploaded!";
}
catch (Exception ex)
{
FileUploaded.Text = "File could not be uploaded.";
}
}
else
{
FileUploaded.Text = "Cannot accept files of this type.";
}
Any help would be appreciated. I working in c# .net2
Thanks
Adam
|
|
|
|
|
http://www.peterprovost.org/archive/2003/05/29/516.aspx[^]
I haven't played around with the Upload stuff yet so not sure whether you can access the uploaded file in memory and resize it before saving it.
If not, then you simply need to use something like
Boolean fileOK = false;<br />
String path = Server.MapPath("~/uploadedconsultantimages/");<br />
if (UploadImage.HasFile)<br />
{<br />
String fileExtension =<br />
System.IO.Path.GetExtension(UploadImage.FileName).ToLower();<br />
String[] allowedExtensions = <br />
{ ".gif", ".png", ".jpeg", ".jpg" };<br />
for (int i = 0; i < allowedExtensions.Length; i++)<br />
{<br />
if (fileExtension == allowedExtensions[i])<br />
{<br />
fileOK = true;<br />
}<br />
}<br />
}<br />
<br />
if (fileOK)<br />
{<br />
try<br />
{<br />
UploadImage.PostedFile.SaveAs(path<br />
+ UploadImage.FileName);<br />
<br />
Bitmap source = Bitmap.FromFile(path + UploadImage.FileName);<br />
Bitmap result = new Bitmap(250,250);<br />
using(Graphics g = Graphics.FromImage((Image)result);<br />
g.DrawImage(source, 0, 0, 250, 250);<br />
result.Dispose();<br />
source.Dispose();<br />
result.Save(path + UploadImage.FileName);<br />
<br />
FileUploaded.Text = "File uploaded!";<br />
}<br />
catch (Exception ex)<br />
{<br />
FileUploaded.Text = "File could not be uploaded.";<br />
}<br />
}<br />
else<br />
{<br />
FileUploaded.Text = "Cannot accept files of this type.";<br />
}
This is untested, but basically "should" resize the uploaded image to 250x250.
|
|
|
|
|
Thanks for this, but im getting errors of the type or namespace could not be found for bitmap and graphics?
|
|
|
|
|
Add System.Drawing in your application
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Thanks, im still getting build errors though:
Error 1 Cannot implicitly convert type 'System.Drawing.Image' to 'System.Drawing.Bitmap'. An explicit conversion exists (are you missing a cast?)
Bitmap source = Bitmap.FromFile(path + UploadImage.FileName);
Thanks
|
|
|
|
|
Bitmap source = (Bitmap)Bitmap.FromFile(path + UploadImage.FileName); try this
Does it will help you ?
Bitmap.FromFile(path + UploadImage.FileName);
return type is Image Why you want to convert it into Bitmap
What you want to do ?
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Ill give it a go, what i want to do is allow the user to upload a picture of themselves which is then resized automatically before it is saved. The image is just getting saved to file rather than in a database.
Thanks
|
|
|
|
|
hi
i am doing on project in asp .net 2.0(with C#) and my backend is sqlserver2000
i want how to pass an argument to crystalreport plz help me
using C# language
Senthil kumar
|
|
|
|
|
search using the keyword "crystalreport push method" in codeproject. Yu will get the result.
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
Hi senthil its easy refer this code...,
Here i am getting values from another page so used session...,
and in crystal report i am sending the values like this:
in ur webpage backend code use this code:
Private report As CrSalaryReport = New CrSalaryReport 'CrSalaryReport ur crystal report name...
CrystalReportViewer1.ReportSource = report
CrystalReportViewer1.Visible = True
CrystalReportViewer1.DisplayToolbar = False
report.SetDatabaseLogon("sa", "Pwd") 'sqlserver login & password
report.SetParameterValue("EmpId", Session("EmpId"))'Parameter1
report.SetParameterValue("EmpName", Session("EmpName"))'parameter2
after that in crystalreport see in field explorer,parameter field add there ur parameter names...,
u can send number of parameters like this...,
It will work nice...,
Regards,
Magesh,
Magi
|
|
|
|
|
Hi
In prev. i ask worng question
I am trying sorting tech. in VJ#
Iam able to sorting fine but i stuck in retriving the Values from file
can nay 1 give me an idea on this
thx
keerthi
|
|
|
|
|
kirthikirthi wrote: I am learning J#
Unwise - J# is being discontinued.
|
|
|
|
|
Thx for reply
I dint get u
I know some basic only in Java
Iam trying in c# and VJ# .net
THX
Keerthi
|
|
|
|
|
J# is being discontinued. Therefore it will not exist soon. Learning a technology that is about to cease to exist is pointless.
|
|
|
|
|
This sounds just like the hundred or so other homework questions people post here daily.
Here's a tip - try it yourself. If you get stuck on any specific part feel free to come back and ask for specific help.
|
|
|
|
|
|
What specifically is it that you need help with? You have just posted your assignment, you don't expect anyone to do your homework, do you?
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi,
I'd been looking around the net for a code that can delete rows in a data grid table but I just can't find any suitable ones.
What I need is that I can multiple delete it and with a message prompt before it delete all the selected one. It don't sound complicated but i just can't seems to get it done.
Would appreciate some help to open up my mind, thanks.
J Liang
|
|
|
|
|
1.First create a template column for data grid
<asp:templatecolumn>
<itemtemplate>
<asp:linkbutton runat="server" id="lnkDelete" text="Delete" onclientclick="return confirm('Are you sure?')" commandname="Delrecd" commandargument="<%# Eval("ProductID")%>">
2.set an event in DataGrid as
OnItemCommand="mydatagrid_ItemCommand"
3.Now in the code behing file in mydatagrid_ItemCommand function
protected void mydatagrid_ItemCommand(object source, DataGridCommandEventArgs e)
{
if (e.CommandName.ToString() == "Delrecd")
{
SqlConnection con = new SqlConnection("connstring");
con.Open();
int pid = Convert.ToInt32(e.Item.Cells[0].Text);
String updtstr = "Delete from products where ProductID=" + pid;
SqlCommand cmd = new SqlCommand(updtstr, con);
cmd.ExecuteNonQuery();
con.Close();
mydatagrid.EditItemIndex = -1;
binddatagrid(); //this method bind data in datagrid
}
}
just follow this u will get what u want bye
PIYUSH
|
|
|
|
|
Hi Piyush,
Thanks, but at later checking, I was wondering is there a different between data grid and data view as it seems mine is data view, that whether the code used is the same.
J Liang
|
|
|
|
|
Hi All,
I have 2 webforms .First Form have one Textbox.I want to display the value of Textbox in webform2 using javascript and then compare both the textboxex using javascript.Pls send me the code.
Thanks.
|
|
|
|
|
u may use the Cross Page Posting feature if u r using ASP.Net 2.0
sreeram
|
|
|
|