|
Hi,
Have you tried this .. this is not my code .. I got it from net...
<br />
Dim client As New WebClient<br />
Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz"<br />
Dim strFilename As String = Server.MapPath("myfile.gz")<br />
client.DownloadFile(strURL, strFilename)
|
|
|
|
|
Server.Mappath is not supported in WCF
|
|
|
|
|
server.mappath is being used to generate a local path(local to the server) .. u can use absolute path.
|
|
|
|
|
sorry I didn't Get What You want to conevy. can you please explain with an example?
|
|
|
|
|
<br />
Dim client As New WebClient<br />
Dim strURL As String = "http://www.someurl.com/sendfile.php?file=myfile.gz"<br />
Dim strFilename As String = "c:\inetpub\wwwroot\my_app\images\myfile.gz"<br />
client.DownloadFile(strURL, strFilename)<br />
i wanted to suggested this workaround .. as server.mappath is not working.
|
|
|
|
|
and what will happen if I upload the web and then i would not be knowing what is the physical path I don't want a tempory solution. It should be ready to launch solution
|
|
|
|
|
Well.. im not aware of what wcf supports .. but there must be some way to find the current directory's path
|
|
|
|
|
May Be But I am not able to serch it till now.
|
|
|
|
|
Fine I got The Answer
The Solution Is Here
modified on Friday, September 11, 2009 9:27 AM
|
|
|
|
|
please help me out quickly
i had a dropdownlist in datagrid with list items from another datagrid while im clicking on the edit link the list items are dissappearing with empty dropdownlist i want list items to be updated when i click update along with other columns following is code for edit and dropdownlist...
protected void DataGid1_EditCommand(object source, DataGridCommandEventArgs e)
{
DataGid1.EditItemIndex = e.Item.ItemIndex;
BindData();
}
protected void DataGid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
SqlConnection cnn = new SqlConnection("Data Source=NETZOOM\\MADHUK_2005;Integrated Security=SSPI;Initial Catalog=master");
string sql = "select dept from dptmnt";
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand(sql, cnn);
cnn.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList DropDownList1 = (DropDownList)((DataGridItem)e.Item).FindControl("DropDownList1");
ListItem li = new ListItem();
DropDownList1.Items.Add(li);
DropDownList1.DataSource = dr;
DropDownList1.DataValueField = "dept";
DropDownList1.DataTextField = "dept";
DropDownList1.DataBind();
}
}
|
|
|
|
|
OK, I can see that you're not working for money, you're just writing code to teach yourself. You should at least look at putting your connection strings into the web config, although this code would still be a long way short of a commercial standard, even if you did that.
I don't see the BindData method, I assume that's the method you want to fill the drop list when the user is editing data ? You have code to fill the drop lists, why do you have a drop list if the item is not being edited ? And why do you read your data source every time, including for rows that are not item rows ?
As I said, a lot of work here. I think you may want to buy a book and work through it, and abandon this test project for now.
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.
|
|
|
|
|
madhukk wrote: please help me out quickly
It's always amusing to me when people are rude enough to put a time limit on free help, don't post all the code needed to help them, and don't respond when people try to help.
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.
|
|
|
|
|
im new to asp... i wasted lot of time working on this please help about dropdownlist
|
|
|
|
|
I did help. I responded, and asked for more details, and made some comments. I assume you're doing some sort of self teaching project ? Why not just simplify it for now ?
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.
|
|
|
|
|
this is complete code what i did.
i am able to access drop list with list items from another table..(dptmnt).
i need to select a list item for each row and should be updated with other columns when i click update link.....
<pre>
SqlConnection cnn = new SqlConnection("Data Source=NETZOOM\\MADHUK_2005;Integrated Security=SSPI;Initial Catalog=master");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
BindData();
}
private void BindData()
{
SqlCommand cmd = new SqlCommand("employee", cnn);
cmd.Parameters.Add(new SqlParameter("@Employee_Name", SqlDbType.VarChar, 20));
cmd.Parameters["@Employee_Name"].Value = "Employee_Name";
cmd.Parameters.Add(new SqlParameter("@position", SqlDbType.VarChar, 20));
cmd.Parameters["@position"].Value = "position";
cmd.Parameters.Add(new SqlParameter("@Team_Name", SqlDbType.VarChar, 20));
cmd.Parameters["@Team_Name"].Value = "Team_Name";
cmd.Parameters.Add(new SqlParameter("@Employee_Id", SqlDbType.VarChar, 20));
cmd.Parameters["@Employee_Id"].Value = 1;
cmd.CommandType = CommandType.StoredProcedure;
SqlDataAdapter ad1 = new SqlDataAdapter(cmd);
string sql = "select dept from dptmnt";
DataSet ds = new DataSet(sql);
ad1.Fill(ds, "employe");
cnn.Open();
cmd.ExecuteNonQuery();
cnn.Close();
DataGid1.DataSource = ds;
DataGid1.DataBind();
}
protected void DataGid1_EditCommand(object source, DataGridCommandEventArgs e)
{
DataGid1.EditItemIndex = e.Item.ItemIndex;
BindData();
}
}
protected void DataGid1_CancelCommand(object source, DataGridCommandEventArgs e)
{
DataGid1.EditItemIndex = -1;
BindData();
}
protected void DataGid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
System.Web.UI.WebControls.TextBox Employee_Name = new System.Web.UI.WebControls.TextBox();
Employee_Name = (System.Web.UI.WebControls.TextBox)e.Item.Cells[1].Controls[1];
System.Web.UI.WebControls.TextBox position = new System.Web.UI.WebControls.TextBox();
position = (System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[1];
System.Web.UI.WebControls.TextBox Team_Name = new System.Web.UI.WebControls.TextBox();
Team_Name = (System.Web.UI.WebControls.TextBox)e.Item.Cells[3].Controls[1];
System.Web.UI.WebControls.TextBox Employee_Id = new System.Web.UI.WebControls.TextBox();
Employee_Id = (System.Web.UI.WebControls.TextBox)e.Item.Cells[4].Controls[1];
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "update employe set Employee_Name=@Employee_Name,position=@position,Team_Name=@Team_Name where Employee_Id=@Employee_Id";
cmd.Parameters.Add(new SqlParameter("@Employee_Name", SqlDbType.VarChar, 20));
cmd.Parameters["@Employee_Name"].Value = Employee_Name.Text;
cmd.Parameters.Add(new SqlParameter("@position", SqlDbType.VarChar, 20));
cmd.Parameters["@position"].Value = position.Text;
cmd.Parameters.Add(new SqlParameter("@Team_Name", SqlDbType.VarChar, 20));
cmd.Parameters["@Team_Name"].Value = Team_Name.Text;
cmd.Parameters.Add(new SqlParameter("@Employee_Id", SqlDbType.VarChar, 20));
cmd.Parameters["@Employee_Id"].Value = Employee_Id.Text;
cnn.Open();
cmd.ExecuteNonQuery();
cnn.Close();
DataGid1.EditItemIndex = -1;
BindData();
}
protected void DataGid1_SelectedIndexChanged(object sender, EventArgs e)
{
DataGid1.SelectedIndex = -1;
BindData();
}
protected void DataGid1_DeleteCommand(object source, DataGridCommandEventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "Delete employe where Employee_Id='@Employee_Id'";
cnn.Open();
cmd.ExecuteNonQuery();
DataGid1.EditItemIndex = -1;
BindData();
}
protected void DataGid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string sql = "select dept from dptmnt";
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand(sql, cnn);
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList DropDownList1 = (DropDownList)((DataGridItem)e.Item).FindControl("DropDownList1");
ListItem li = new ListItem();
DropDownList1.Items.Add(li);
DropDownList1.DataSource = dr;
DropDownList1.DataValueField = "dept";
DropDownList1.DataTextField = "dept";
DropDownList1.DataBind();
cmd.Connection.Close();
}
}
</pre>
|
|
|
|
|
madhukk wrote: DataGid1.EditItemIndex = e.Item.ItemIndex;
BindData();
But, this just binds the grid to the same data source it had to start with. How is that supposed to help fill any drop down list ?
madhukk wrote: protected void DataGid1_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
string sql = "select dept from dptmnt";
DataSet ds = new DataSet();
SqlCommand cmd = new SqlCommand(sql, cnn);
cmd.Connection.Open();
SqlDataReader dr = cmd.ExecuteReader();
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
DropDownList DropDownList1 = (DropDownList)((DataGridItem)e.Item).FindControl("DropDownList1");
ListItem li = new ListItem();
DropDownList1.Items.Add(li);
DropDownList1.DataSource = dr;
DropDownList1.DataValueField = "dept";
DropDownList1.DataTextField = "dept";
DropDownList1.DataBind();
cmd.Connection.Close();
}
I have the same questions about this mess as I did in my first post.
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.
|
|
|
|
|
|
you know, every day, people who are obviously not qualified to write commercial code, post here about obviously commercial projects, and we're expect to offer our help for free on projects we can't get, because you've underbid us, obviously on the basis that you don't have the skills to work in this area, and therefore are happy to earn whatever you can get. Then when we answer you, we have to ask questions to try to get to the bottom of things, your code is so bad that we end up commenting on a lot of different things that need improvement, and when we get to the point where we've asked for more info so we can still try to offer you free help, although you're stealing from us, you cut the conversation short by saying something like 'ok thanks I got it....'. Do you really get that you're not able to write software for a client at this point ? Do you have any plans to learn ? Do you understand anything I said ?
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.
|
|
|
|
|
As i said previously i am very much new to this....
and what i got is im just adding the dropdownlist and i dint write any code to update....
Yes as u said i need to work hard...
|
|
|
|
|
Well, if you're doing paid work, then you need to stop. If you're doing work to learn, then yes, there's nothing wrong with that, but what you're trying to do right now is obviously far too complex for you.
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.
|
|
|
|
|
Hi,
anybody know that ,
How to get Mac Address ?
Thanx in Advance.
|
|
|
|
|
Priyagdpl wrote: How to get Mac Address ?
Is it related to ASP.Net? NO.
Btw, here [^]is an example of how to do this in C#
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
It is not possible.
You can only access the things that comes from Request headers. You can only check IP address of the client. MAC address is not accessible.
|
|
|
|
|
I m building a aspx (c#) web application.
It requires support to french language....
So that the user can just click the option and the messages, Label text, button text font changes from english to french.
Any Article, link url, sample project in C# ASP.net......
Please give suggestion regarding this....
Thanx in advance.....
|
|
|
|
|
You have to make every string in your program read from string tables, and set up string tables for different languages.
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.
|
|
|
|