|
|
ArunkGeorge wrote: what is your bloody problem?
I have no problem. I simply pointed out something that should have been self-evident to a perceptive fellow like you.
By the way, you can have the last word on this sub thread, I shan't read it.
|
|
|
|
|
Hello Friends,
I am looking for a script in which user can upload an image from his machine and place it over another image.
He should be allowed to place the new image anywhere on the already existing image and should be allowed to resize the uploaded image. Its something like customising a greeting card on moonpig.com where user can upload his image and place it over the card and resize it as well. Could anyone please point me to the correct script. I am looking for this in Javascript, DHTML, AJAX.
Thanks
|
|
|
|
|
It is not easy to achieve I guess. You need a strong knowledge on Javascript and ServerSide image resizing to do this.
Let me give you some hint from where to start :
Do a normal upload of an image file.
Put a div and load the image in its background using CSS
like background : url('imgurl')
Now place an absolute position div which allows you to resize just over the div you placed. you can adjust div.clientHeight, div.offsetLeft, div.scrollLeft to position the div on exactly over the image.
When user is done, you need to actually crop the image based on the size of the div which is floating above the div.
Cropping an image is not a big deal, there are lots of codes available for that, Just you need to find the actual value of the Rectangle that the user adjusted for cropping.
This might help you in this regard[^]
Wish you luck in this
|
|
|
|
|
thanks for the reply and I already did that but unfortunately it was not the result what I am after;
|
|
|
|
|
If not so, tell me what output you want ?
|
|
|
|
|
Hi,
I am looking for something like www.moonpig.com where user can upload an image and resize, move and put it over a card and preview his card with his image on it. basically uploading an image over another image and previewing it.
|
|
|
|
|
|
hi jayapal,
thanks for pointing me to the links which are really very good tools to be used.
I will look all the possibilities and try and build whatever I am looking for.
my requirement is basically like customising a card or tshirt where user can upload an image from his local machine and preview in our product and proceed with the order;
|
|
|
|
|
Hi,
I call a javascript function b from another function a.
in the function b at certain conditions i want to stop the javascript execution and i have did it by throwing an exception by using Throw New Error('Stopi').
It is working well.
1. Is it good to stop the execution of javascript abruptly.
2. Is it bad if the functions are not returned to the calling function and finally to the operating system.
3. I will there be a over flow of stack or will stack keep increasing if i am throwing many such errors.
Meanwhile IE shows the yellow exclamation icon in its status bar as usual that there is a javascript exception. When you click that you can see the error description as 'Stopi' which i have thrown.
Here is an example...
<input type='text' name='name' id='name' />
function validate()<br />
{<br />
isempty('name','Please enter your name');<br />
}<br />
<br />
function isempty(src,msg)<br />
{<br />
var so = document.getElementById(src)<br />
if(so.value=='')<br />
{<br />
alert(msg)<br />
so.focus()<br />
throw new Error('Stopi')<br />
}<br />
}
so i dont have to use if condition when validating. no braces, no return statement, and no need to call focus for every if condition so this code reduces 6 lines and multiplied by number of input controls you are going validate. so i just need to call isempty and if the control has empty value then the user will get an alert and the execution stops.
Please suggest.
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Although your approach is not that bad, I would declare a variable which indicates all fields are validated.
<br />
<script language="javascript" type="text/javascript"><br />
var bValid = new Boolean();<br />
bValid = true;<br />
</script><br />
Then I would change the function isempty like so :
function isempty(src, msg)
{
var so = document.getElementById(src)
if(so.value=='')
{
alert(msg)
so.focus()
bValid = false;
}
else
{
bValid = true;
}
}
|
|
|
|
|
hi,
thats nice but i call too many functions like isempty...
besides IE shows the yellow error exclamation...
Today's Beautiful Moments are
Tomorrow's Beautiful Memories
|
|
|
|
|
Explore Windows Server 2008 R2 release via a self-paced free training course of videos and hands-on-labs with a focus on performance, web, management, and other server solution scenarios.
Learn about parallel programming, trigger started services, PowerShell features, File Classification Infrastructure, Web extensions, and how to automate your dev-test environment with VHD and Hyper-V API’s.
See Windows Server 2008 R2 Developer Training[^]
|
|
|
|
|
Hi,
I have a datagrid(with update and cancel buttons) and I have implemented sorting and custom paging on this datagrid. Everything was working fine. BUT when I sort the contents of the datagrid or change the page of the datagrid and then if I click on the Edit button, for example if I click the edit on the first row of the second page then the row which the editItemIndex highlights is the first row of the FIRST page. Similar problem faced if i sort the datagrid and click on any edit row of the sorted datagrid. The main problem lies in accessing the row, in my code i use
dataGrid.EditItemIndex = e.Item.ItemIndex;
But the above does not work properly. I even tried-
dataGrid.EditItemIndex = e.Item.DataSetIndex;
But the above also does not work.
The entire code is mentioned below for your reference. PLEASE HELP ME. THANKS IN ADVANCE.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
ClsMngr obj = new ClsMngr();
ClsUsers objUsers = new ClsUsers();
public static int numberDiv;
private int TotalRecords = 0;
private int TotalPages = 0;
private int PageSize = 0;
private int CurrentPage = 0;
protected void Page_Load(object sender, EventArgs e)
{
dataGrid.PagerStyle.Mode = PagerMode.NumericPages;
if (!IsPostBack)
{
fillDataGrid();
}
}
protected void dataGrid_Edit(object source, DataGridCommandEventArgs e)
{
dataGrid.EditItemIndex = e.Item.ItemIndex;
fillDataGrid();
}
protected void dataGrid_Update(object source, DataGridCommandEventArgs e)
{
objUsers.Action = "update";
objUsers.UserId = Convert.ToInt32(e.Item.Cells[0].Text);
objUsers.UserName = ((TextBox)e.Item.Cells[1].Controls[0]).Text;
objUsers.GroupId = Convert.ToInt32(((DropDownList)e.Item.Cells[2].Controls[0].FindControl("ddlGroup")).Text);
obj.Users(objUsers);
Response.Redirect("DataGrid.aspx");
}
protected void dataGrid_Cancel(object source, DataGridCommandEventArgs e)
{
dataGrid.EditItemIndex = -1;
fillDataGrid();
}
protected void dataGrid_Delete(object source, DataGridCommandEventArgs e)
{
objUsers.Action = "delete";
objUsers.UserId = Convert.ToInt32(e.Item.Cells[0].Text);
obj.Users(objUsers);
Response.Redirect("DataGrid.aspx");
}
protected void dataGrid_ItemDataBound(object sender, DataGridItemEventArgs e)
{
object objGroupId = DataBinder.Eval(e.Item.DataItem, "User_GroupId");
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.Item ||
e.Item.ItemType == System.Web.UI.WebControls.ListItemType.AlternatingItem)
{
e.Item.Cells[2].Text = GetGroupName(Convert.ToInt32(objGroupId));
}
if (e.Item.ItemType == System.Web.UI.WebControls.ListItemType.EditItem)
{
ClsGroups objGroups = new ClsGroups();
objGroups.Action = "select";
objGroups.GroupIdFlag = 1;
objGroups.NameEngFlag = 1;
DataTable dtGroup = obj.Groups(objGroups);
((DropDownList)e.Item.FindControl("ddlGroup")).DataSource = dtGroup;
((DropDownList)e.Item.FindControl("ddlGroup")).DataValueField = "Group_GroupId";
((DropDownList)e.Item.FindControl("ddlGroup")).DataTextField = "Group_NameEng";
((DropDownList)e.Item.FindControl("ddlGroup")).SelectedValue = objGroupId.ToString();
((DropDownList)e.Item.FindControl("ddlGroup")).DataBind();
}
}
private string GetGroupName(int intGroupId)
{
ClsGroups objGroups = new ClsGroups();
objGroups.Action = "select";
objGroups.GroupId = intGroupId;
objGroups.GroupIdFlag = 1;
objGroups.NameEngFlag = 1;
DataTable dtGroup = obj.Groups(objGroups);
if (dtGroup.Rows.Count == 0) return "";
return dtGroup.Rows[0]["Group_NameEng"].ToString();
}
protected void Pager(object source, DataGridPageChangedEventArgs e)
{
dataGrid.CurrentPageIndex = e.NewPageIndex;
fillDataGrid();
}
protected void NavigationLink_Click(object source, CommandEventArgs e)
{
int RecordCount;
DataTable dSet = null;
dSet = (DataTable)Cache["AllRecords"];
PageSize = dataGrid.PageSize;
switch (e.CommandName)
{
case "First":
ViewState["CurrentPage"] = 0;
dataGrid.CurrentPageIndex = 0;
dataGrid.DataSource = dSet;
dataGrid.DataBind();
PreviousPage.Enabled = false;
NextPage.Enabled = true;
FirstPage.Enabled = false;
LastPage.Enabled = true;
TotalRecords = (int)ViewState["TotalRecords"];
lblPageDetails.Text = "1 - " + PageSize.ToString() + " of " + TotalRecords.ToString();
break;
case "Last":
TotalPages = (int)ViewState["TotalPages"];
ViewState["CurrentPage"] = TotalPages - 1;
dataGrid.CurrentPageIndex = TotalPages - 1;
dataGrid.DataSource = dSet;
dataGrid.DataBind();
NextPage.Enabled = false;
PreviousPage.Enabled = true;
LastPage.Enabled = false;
FirstPage.Enabled = true;
RecordCount = (TotalPages - 1) * PageSize;
TotalRecords = (int)ViewState["TotalRecords"];
lblPageDetails.Text = (RecordCount + 1).ToString() + " - " + TotalRecords.ToString() + " of " + TotalRecords.ToString();
break;
case "Next":
CurrentPage = (int)ViewState["CurrentPage"];
CurrentPage = CurrentPage + 1;
ViewState["CurrentPage"] = CurrentPage;
dataGrid.CurrentPageIndex = CurrentPage;
dataGrid.DataSource = dSet;
dataGrid.DataBind();
RecordCount = CurrentPage * PageSize;
TotalRecords = (int)ViewState["TotalRecords"];
if (CurrentPage == dataGrid.PageCount - 1)
{
NextPage.Enabled = false;
PreviousPage.Enabled = true;
LastPage.Enabled = false;
FirstPage.Enabled = true;
lblPageDetails.Text = (RecordCount + 1).ToString() + " - " + TotalRecords.ToString() + " of " + TotalRecords.ToString();
}
else
{
NextPage.Enabled = true;
PreviousPage.Enabled = true;
LastPage.Enabled = true;
FirstPage.Enabled = true;
lblPageDetails.Text = (RecordCount + 1).ToString() + " - " + (RecordCount + PageSize).ToString() + " of " + TotalRecords.ToString();
}
break;
case "Prev":
CurrentPage = (int)ViewState["CurrentPage"];
CurrentPage = CurrentPage - 1;
ViewState["CurrentPage"] = CurrentPage;
dataGrid.CurrentPageIndex = CurrentPage;
dataGrid.DataSource = dSet;
dataGrid.DataBind();
RecordCount = CurrentPage * PageSize;
TotalRecords = (int)ViewState["TotalRecords"];
if (CurrentPage == 0)
{
PreviousPage.Enabled = false;
NextPage.Enabled = true;
FirstPage.Enabled = false;
LastPage.Enabled = true;
lblPageDetails.Text = "1 - " + PageSize.ToString() + " of " + TotalRecords.ToString();
}
else
{
NextPage.Enabled = true;
PreviousPage.Enabled = true;
LastPage.Enabled = true;
FirstPage.Enabled = true;
lblPageDetails.Text = (RecordCount + 1).ToString() + " - " + (RecordCount + PageSize).ToString() + " of " + TotalRecords.ToString();
}
break;
}
}
protected void onSort(object source, DataGridSortCommandEventArgs e)
{
objUsers.Action = "select";
DataTable dtUsers = obj.Users(objUsers);
if (dtUsers != null)
{
DataView dataView = new DataView(dtUsers);
if ((numberDiv % 2) == 0)
dataView.Sort = e.SortExpression + " " + "ASC";
else dataView.Sort = e.SortExpression + " " + "DESC";
numberDiv++;
dataGrid.DataSource = dataView;
dataGrid.DataBind();
}
}
private void fillDataGrid()
{
objUsers.Action = "select";
DataTable dtUsers = obj.Users(objUsers);
Cache["AllRecords"] = dtUsers;
DataTable dtUsersNew = new DataTable();
dtUsersNew = (DataTable)Cache["AllRecords"];
ViewState["TotalRecords"] = dtUsersNew.Rows.Count;
dataGrid.CurrentPageIndex = 0;
dataGrid.DataSource = dtUsersNew;
dataGrid.DataBind();
TotalRecords = (int)ViewState["TotalRecords"];
ViewState["TotalPages"] = dataGrid.PageCount;
ViewState["CurrentPage"] = 0;
PreviousPage.Enabled = false;
NextPage.Enabled = true;
FirstPage.Enabled = false;
LastPage.Enabled = true;
if (TotalRecords == 0)
{
dataGrid.Visible = false;
Panel1.Visible = false;
}
else if (TotalRecords <= dataGrid.PageSize)
{
dataGrid.Visible = true;
Panel1.Visible = true;
lblPageDetails.Text = "1 - " + TotalRecords.ToString() + " of " + TotalRecords.ToString();
NextPage.Enabled = false;
LastPage.Enabled = false;
}
else
{
dataGrid.Visible = true;
Panel1.Visible = true;
lblPageDetails.Text = "1 - " + dataGrid.PageSize.ToString() + " of " + TotalRecords.ToString();
}
}
}
|
|
|
|
|
1) There is a specific ASP.NET forum
2) No one is going to read all of this code
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Hi,
I have a developed a mobile client application for which i wants to make a server application.
I have my website which have a database to it and i wants that both server application and my website will share the same database.
The main feature of the server application i to make continuous http request to a URL and capture the response and perform according to the response.
But i dont know what to do in this regards, i am totally stucked to this please help me what to do.
which kind of application i have to make either web application or web services & how i will integrate it to my website.
Thanks in advance
|
|
|
|
|
I believe what you want to do is:
1) Store the database on your website
2) Create whatever web-app you want on your website
3) Create a data access layer to your database which exposes a series of webservices for your data.
4) Modify your mobile client application to use those webservices to access the data which is stored on your website.
You can poll the webservice as often as you would like to get the latest data from the server. Or, maybe you should think of a "push" architecture where the webserver would generate an email to the client indicating that data has changed, maybe even send the new data to the client as an XML attachment which could be used to update the client.
Good luck.
David
|
|
|
|
|
My Name is Jennifer Clark I am in the business of sales and retails for last few years, now I am thinking to make my business on web, I came across the company Webplore. They are in offering Web site Development Services, Application Maintenance Services, Product Development Services, and Search Engine Optimization Services.
|
|
|
|
|
I guess you're advertising here :S
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
Blatent advertising. Clear off.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
Interesting post. The webplore company site has major design flaws, such as looping back to the home page on a lot of links. It also has no published address or phone number, and google can't find that info anywhere else either.
Obviously Jennifer is either employed by, or is, this company. She seems to have posted on a lot of forums with the same advertising junk.
I just think it is a shame that now the entire world knows not to use them for web development because of a poorly executed publicity campaign, not that anyone is able to contact them anyway. What a waste of Jennifer's time.
If you have knowledge, let others light their candles at it.
Margaret Fuller (1810 - 1850)
www.JacksonSoft.co.uk
|
|
|
|
|
Wow - you really think we're all stupid. AND you seem to think that a forum full of web developers is a good place to pimp your company. That's really quite amusing, in a sad sort of way.
Don't give up your day job.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
|
|
how i can parse the jquery json object to data in asp.net..
here is my client side test code
********************************
var prdnameArray = new Array();
prdnameArray[0]="Saab";
prdnameArray[1]="Volvo";
prdnameArray[2]="BMW";
var prdamountArray=new Array();
prdamountArray[0]="456";
prdamountArray[1]="789";
prdamountArray[2]="678";
var data = {
"sales": [
{"prdnameArray":prdnameArray},
{"prdamountArray":prdamountArray}
]
}
alert(data);
//alert(data.sales[0].prdnameArray[0]);
$.ajax({
type: "POST",
url: "jsonIntro.aspx",
timeout: 5000,
data:data,
contentType:"application/json;charset=utf-8",
dataType:"JSON",
success: function(d) {
alert(d);
return false;
},
error: function(request, status, errorThrown) {
alert(status);
}
});
*************************************************
iam using stream reader to read the object and trying to parse using json parser...but always it shows error..
my C# asp.net code is like this.
****************************
System.IO.StreamReader sr = new System.IO.StreamReader(Request.InputStream);
JsonParser parser = new JsonParser(sr, true);
JsonObject obj = (JsonObject)parser.ParseObject();
JsonArray prdname = (JsonArray)obj["sales"][0];
Response.Write(prdname[0]);
*******************************
Anyone help me???
Thanks in advance...
|
|
|
|