|
I want to say I found the problem but the truth is I removed the table around the list box and it worked!
I replaced the table and it still worked! I don't know what the problem was but it is fixed now.
|
|
|
|
|
Hey folks,
I need to build an application that does some local file manipulation (editing, copying, etc.) on the behalf of the user.
How restrictive is ASP in terms of client side machine access?
I could just write a client-server app instead, but seems like that would take bit more effort.
Thx
NIK
|
|
|
|
|
nicknotyet wrote: How restrictive is ASP in terms of client side machine access?
All you need is to give the asp user account permission to the folder where the files are located. It is that simple.
[edit] my bad. I did not read OP post completely. There is no way you can access the client machine from asp.net [/edit]
modified on Thursday, April 23, 2009 9:32 AM
|
|
|
|
|
Really!!!
So I can just use something like
string path = "C:\\MyFiles\SomeFile.Txt";
File.OpenText(path);
...
in code behind?
|
|
|
|
|
No. Actually, ASP/ASP.NET will not have any access to the client's computer drives at all. I think only an ActiveX control might be able to access client files. Doing what you wrote would open SomeFile.Txt in the C:\\MyFiles directory of the server.
Scott
|
|
|
|
|
One Yes and One No - I am well confused.
|
|
|
|
|
nicknotyet wrote: One Yes and One No - I am well confused.
my bad. I have to read your post again. scottgp is right, you can not access client machine from asp.net. I read your post as you want to access server files.
The only way you can access client machines is through explicit permission of the use and other technologies such as activex.
sorry of the confusion, I take my earlier post back
|
|
|
|
|
No worries, at least I can make an informed decision.
I am kind of inclined to just do this old-school and roll my own pseudo database and write the app in straight C/++. It will be screaming fast and have no platform dependencies. The time I would have spent ramping up on SQL, .NET, DAO, IIS, etc, can be spent on implementation.
Thanks again for the input.
NIK
|
|
|
|
|
I have a query suppossed to return average values (SELECT AVG(DATA_VALUE)....).
However, it returns null when no data is present for the matching criteria.
I am using a data reader to read the value. like:
<br />
dr = cmdSelect.ExecuteReader();<br />
if (dr.HasRows)<br />
{<br />
dr.Read();<br />
string getAvg = dr.GetString(0);<br />
if (getAvg != null)<br />
{<br />
valArr[0] = Convert.ToDouble(getAvg);<br />
log.Add(...);<br />
}<br />
else{...}<br />
} <br />
Funny thing is - dr.HasRows is true because the query is returning a record even though the value is null. I also tried GetObject(0) instead of GetString(0), and tried cmd.ExecuteScalar() instead of ExecuteReader(), but still could not manage it. Its going to an Exception saying - "Data is Null. This method or property cannot be called on Null values."
Any help? Thanks.
|
|
|
|
|
all you need is DBNull[^]class
<br />
if (! DBNull.Value.Equals(dr[fieldName])) <br />
{<br />
}
|
|
|
|
|
You can handle that as below:
if (dr["fieldname"] != null)
{
//do something
}
|
|
|
|
|
|
I have tree view control on my asp.net web page.
this tree control has check boxes on every node.
I want when user selects or make parent node check box checked then its child should also get checked automatically.
how can i do this ?
kindly its urgent, plz send some code hints.
|
|
|
|
|
Write some fancy javascript to update all the sub nodes that contain a checkbox, or put the treeview in an ajax panel and use server side code to check all the checkboxes.
I didn't get any requirements for the signature
|
|
|
|
|
we r using asp.net and we have also created check boxes, we want parent node check box checked then its child should also get checked automatically.
|
|
|
|
|
enumerate though the childnodes and check the checkboxes.
Post your code so you can get further help.
|
|
|
|
|
heres the code
public partial class _Default : System.Web.UI.Page
{
public static SqlConnection sqlConn = new SqlConnection();
public static SqlCommand sqlCmmd = new SqlCommand();
public static SqlDataAdapter sqlDAptr = new SqlDataAdapter();
protected void Page_Load(object sender, EventArgs e)
{
try
{
PassQuery();
}
catch (Exception)
{
throw;
}
}
public void PassQuery()
{
this.TreeView1.Nodes.Clear();
DataSet myFirstTable = new DataSet();
string Query = "select name from sys.tables";
myFirstTable = Retun_Table_BasedOn_Query(Query);
DataSet[] mySecondTable = new DataSet[myFirstTable.Tables[0].Rows.Count];
for (int i = 0; i < myFirstTable.Tables["Table"].Rows.Count; i++)
{
string str1 = myFirstTable.Tables["Table"].Rows[i][0].ToString();
string Query2 = "SELECT sysobjects.name As Names, syscolumns.name AS FieldName " +
"FROM sysobjects INNER JOIN syscolumns ON sysobjects.id = syscolumns.id " +
"WHERE (sysobjects.name = '" + str1 + "')";
mySecondTable[i] = Retun_Table_BasedOn_Query(Query2);
TreeNode tnParent;
TreeNode tnChild;
for (int a = 0; a < 1; a++)
{
tnParent = new TreeNode();
tnParent.Text = str1.ToString();
TreeView1.Nodes.Add(tnParent);
foreach (DataRow rowChild in mySecondTable[i].Tables["Table"].Rows)
{
tnChild = new TreeNode();
tnChild.Text = rowChild["FieldName"].ToString();
tnParent.ChildNodes.Add(tnChild);
}
}
}
}
public void Open_Connection()
{
string Conn_Str = "Data Source=dev-test;Initial Catalog=Malik;Persist Security Info=True;User ID=interns;Password=intern123";
sqlConn = new SqlConnection(Conn_Str);
if (sqlConn.State != ConnectionState.Open)
{
sqlConn.Open();
}
}
public DataSet Retun_Table_BasedOn_Query(String Query)
{
Open_Connection();
DataSet mydataSet = new DataSet();
sqlCmmd = new SqlCommand(Query, sqlConn);
sqlDAptr = new SqlDataAdapter(sqlCmmd);
sqlDAptr.Fill(mydataSet);
return mydataSet;
}
}
help
|
|
|
|
|
T_Teef wrote:
Open_Connection();
DataSet mydataSet = new DataSet();
sqlCmmd = new SqlCommand(Query, sqlConn);
sqlDAptr = new SqlDataAdapter(sqlCmmd);
sqlDAptr.Fill(mydataSet);
return mydataSet;
FYI. If you pass an open connection to a SqlDataAdapter it will not close automatically. Check your sql server you probably have a bunch open connections that aren't being closed.
Also, where is your code to handle the treeviews click event?
I didn't get any requirements for the signature
|
|
|
|
|
thats why we have posted the code to get the help to obtain a piece of code to handle the treeviews click event
|
|
|
|
|
hello,
i want to add a "hello ___" to all my pages.
now , in order not to duplicate code , i can put it in the master page.
in the master page i go and look for the user entered from the query string at the DB and put the name after the hello or Guest if i get null.
this works fine.
now, in the child pages i also want to use this DB output , so i use session to store the DB entry for later use by the child.
my problem is that the child page's On_Load is performed prior to the Master page's On_Load and this causes the DB entry to be null before it was read by the Master page.
does anyone have any idea how to solve this problem ?
can i use the Page_Init in the master page for this ? is it acceptable and stable ?
tnx,
avi
modified on Wednesday, April 22, 2009 3:54 PM
|
|
|
|
|
Use the Mater Page's Page_Init event to run the code. That event fires before the child pages load event.
I didn't get any requirements for the signature
|
|
|
|
|
ok , tnx
|
|
|
|
|
How do I store a custom object in a ViewState. I know that viewstates do not support XmlSerialization. I currently have a class that is using XmlSerialization and all hell is breaking lose when trying to set a viewstate entry to that value.
|
|
|
|
|
ViewState is actually a name / value collection. You can't store a class in ViewState.
You can store a serializable object in Session though.
I didn't get any requirements for the signature
|
|
|
|
|
You can store an object inside a viewstate as long as it is BinaryFormat-able.
|
|
|
|