|
Does the ASPNET worker process have the appropriate permissions to access the directory?
|
|
|
|
|
Im new in asp.net 2. I had created a sample web site. I want to make it as a local web site.
So how can I do this to a new web server.
Thanks
|
|
|
|
|
Please tell me the exact difference between server.transfer and response.redirect.
|
|
|
|
|
http://www.google.co.in/search?hl=en&q=server.transfer+response.redirect+&btnG=Google+Search&meta=
Best Regards,
Apurva Kaushal
|
|
|
|
|
|
Using Querystring
Querystring is a day old mechanism to pass values across pages. The main advantage of this method is it is very simple. However, disadvantages are the values are visible in the browser address bar and you can not pass objects this way. This method is best suited when you want to pass small number of values that need not be secured from others. In order to implement this method you will follow these steps:
§ Create the web form with controls
§ Provide some button or link button that posts the form back
§ In the click event of the button create a string that holds URL for another
§ Add control values to this URL as querystring parameters
§ Response.Redirect to another form with this URL
Following code snippet shows how it works:
Source Web Form
private void Button1_Click
(object sender, System.EventArgs e)
{
string url;
url="anotherwebform.aspx?name=" +
TextBox1.Text + "&email=" +
TextBox2.Text;
Response.Redirect(url);
}
Destination Web Form
private void Page_Load
(object sender, System.EventArgs e)
{
Label1.Text=Request.QueryString["name"];
Label2.Text=Request.QueryString["email"];
}
Server.Transfer
This is yet another way to pass values across pages. Here you store control values in session variables and access them in another web form. However, as you know storing too much data in session can be an overhead on the server. So, you should use this method with care. Also, it requires some kind of clean up action from your side so that unwanted session variables are removed. The typical sequence of steps will be as follows:
§ Create the web form with controls
§ Provide some button or link button that posts the form back
§ In the click event of the button add session variables and set them to control values
§ Response.Redirect to another form
§ In that form access Session variables and remove them if necessary
Following code shows this in action:
Source Web Form
private void Button1_Click
(object sender, System.EventArgs e)
{
//textbox1 and textbox2 are webform
//controls
Session["name"]=TextBox1.Text;
Session["email"]=TextBox2.Text;
Server.Transfer("anotherwebform.aspx");
}
Destination Web Form
private void Page_Load
(object sender, System.EventArgs e)
{
Label1.Text=Session["name"].ToString();
Label2.Text=Session["email"].ToString();
Session.Remove("name");
Session.Remove("email");
}
|
|
|
|
|
I found out we could bind datareader to grid, dropdown list etc. but can we bind datareader to textboxes? if it is possible how to do it?
|
|
|
|
|
hi,
yes you can bind textboxes to a datareader. A textbox can be bounded with one record of a datareader object like that.....
Connection.Open();<br />
reader=SqlCommand.ExecuteReader();<br />
reader.Read();<br />
TextBox1.Text =reader.GetString(1);
Tirtha
Live life to the fullest
|
|
|
|
|
i dont think so you can bind to textbox. you can set the value from reader to textbox.
Nav.
|
|
|
|
|
hi nav,
yes you are partially right. actually the problem arises when the datareader has null values.Isnt it? Other wise do u think that the following code is incorrect.
txtName.text=reader("Name")
whats ur opinion?
Tirtha
Live life to the fullest
|
|
|
|
|
completley agree with you its ok if we not getting any null values. and we can set a check for null as wel. but if we look at the question its not binding its jus a way to getting and setting a value to textbox.
regards
Nav.
|
|
|
|
|
hi nav,
Ok Ok.agree with u. now its settled.
Tirtha
The best prophet of the future is the past
Live life to the fullest
|
|
|
|
|
thats like a good boy.
take care
Nav.
|
|
|
|
|
I want to use DataViewManager to bind data to a datagrid in Asp.Net. How is this possible?
|
|
|
|
|
first create a datatable
DataTable dt = new DataTable("TestDT");<br />
dt.Columns.Add("ID");<br />
dt.Columns.Add("NAME");<br />
for(int n=1; n<3; n++)<br />
{<br />
DataRow dr = dt.NewRow();<br />
dr["ID"] = n.ToString();<br />
dr["NAME"] = n.ToString() + n.ToString();<br />
dt.Rows.Add(dr);<br />
}
then add datatable to Dataset
DataSet ds = new DataSet("TestDS");<br />
ds.Tables.Add(dt);
Create dataviewmanager
DataViewManager dvm = new DataViewManager(ds);
bind it to datagrid
dataGrid1.DataSource = dvm;
and finish
Nav.
|
|
|
|
|
i tried it old boy.
its not working.
for vb it is ok coz when we give datagrid.setdatabindings it is working.
but for asp it is not working. i mean the datagrid.datasource is not binding it.
love,
lav
|
|
|
|
|
hi,
i m having a javascript function in my aspx.cs file as
// To pop up confirmation box for dissociation
function confirmdissociation ()
{
if (confirm("Are you sure to perform this action?")==true)
return true;
else
return false;
}
In code behind , i have
bool getresult;
Button1.Attributes("script","return confirmdissociation();");
I want to store the result retured from this in a bool variable getresult (declared in code behind)
Please help
sandeep
|
|
|
|
|
You can try something like this:
Javascript Code:
<script language="javascript" type="text/javascript">
function confirmdissociation ()
{
//alert("In Code");
if (confirm("Are you sure to perform this action?")==true)
{
document.getElementById("TextBox1").innerText ="true";
return true;
}
else
{
document.getElementById("TextBox1").innerText ="false";
return false;
}
}
</script>
In Code Behind:
private void Page_Load(object sender, System.EventArgs e)
{
Button1.Attributes.Add("onclick", "confirmdissociation();");
}
--Dimple
|
|
|
|
|
Greetings!
I've got a slight problem with an ObjectDataSource i'd like to get your input on.
I've got an ASP.NET website created with two added references: A data access layer, and a buisness logic layer. The DLL's are both located in the BIN folder of the website.
The BLL classes are outfitted with the [System.ComponentModel.DataObject] and should be visible from the DataObjectSource's datasouce dropdown. However, they're not. I noticed something rather odd: I had only 1 page defined (default.aspx), and when i tried to define a data source for the ObjectDataSource, no classes were available what so ever. I then added a class to the "App_Code" folder and tried again. This time it cought on to all my TableAdapters and their underlying classes in the DAL.
It still refuses to include any of the BLL classes.
Can anyone shed light on the situation?
Thank you in advance.
- Martin Kjeldsen
|
|
|
|
|
Hi there,
Do you see the business classes listed in the combox if you uncheck the checkbox "Show only data components" in the Configuration DataSource dialog box?
|
|
|
|
|
hi
If i check "show only data components" i get a list of the table adapters available from my DAL dll. If i uncheck it, i get a list of all the classes related to my defined DataSet (Table, Row, etc). But there is no sign of the BLL classes, even tho it exists as a reference in the "BIN" folder. It puzzles me.
I even tried to copy one of the classes from my BLL dll directly into the APP_CODE folder, but the ObjectDataSource still won't recognize it, no matter if i check or uncheck "show only.."
Thanks for your input!
- Martin
-- modified at 5:23 Thursday 6th July, 2006
|
|
|
|
|
May I see the signature of one of the BLL classes?
|
|
|
|
|
Hi again, Here's one of the BLL test classes i'm using.
using System;<br />
using System.Collections.Generic;<br />
using System.Text;<br />
using DALTest.EmployeesDataSetTableAdapters;<br />
using DALTest;<br />
<br />
namespace BLL<br />
{<br />
[System.ComponentModel.DataObject]<br />
class EmployeesBLL<br />
{<br />
private EmployeesTableAdapter _employeesAdapter = null;<br />
<br />
protected EmployeesTableAdapter Adapter<br />
{<br />
get<br />
{<br />
if (_employeesAdapter == null)<br />
_employeesAdapter = new EmployeesTableAdapter();<br />
<br />
return _employeesAdapter;<br />
}<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select,true)]<br />
public DALTest.EmployeesDataSet.EmployeesDataTable GetEmployee(int employeeId)<br />
{<br />
return Adapter.GetData(employeeId);<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Select,false)]<br />
public DALTest.EmployeesDataSet.EmployeesDataTable GetEmployeesByCountry(string country)<br />
{<br />
return Adapter.GetDataByCountry(country);<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Insert, true)]<br />
public bool AddEmployee(string employeeName)<br />
{<br />
DALTest.EmployeesDataSet.EmployeesDataTable employees = new DALTest.EmployeesDataSet.EmployeesDataTable();<br />
DALTest.EmployeesDataSet.EmployeesRow employee = employees.NewEmployeesRow();<br />
employee.FirstName = employeeName;<br />
employee.LastName = employeeName;<br />
employees.AddEmployeesRow(employee);<br />
int rowsAffected = Adapter.Update(employee);<br />
return rowsAffected == 1;<br />
}<br />
<br />
[System.ComponentModel.DataObjectMethodAttribute(System.ComponentModel.DataObjectMethodType.Delete, true)]<br />
public bool DeleteEmployee(int employeeId)<br />
{<br />
int rowsAffected = Adapter.Delete(employeeId, new DateTime());<br />
return rowsAffected == 1;<br />
}<br />
<br />
}<br />
}
|
|
|
|
|
zrrbite wrote: class EmployeesBLL
Here's the culprit, the class needs to be declared as public .
|
|
|
|
|
Wow, what a horrible mistake. I feel stupid
Thanks alot.
|
|
|
|