|
you can set the session timeout period in the IIS .
The default session time out period is 20 minutes.
otherwise you can set it session.timeout="30" in the code behind file.
The value must be in minutes.
try this.
Sathesh Pandian
|
|
|
|
|
Hello, you majestry ALL!
I'm a very new user in ASP.NET and I have an elementary question but I don't know an answer.
I guess nearly all examples work with databases use Nortwind database.
I have VS2005 and MSSQLServer 2005 Express Edition - where I can download this database and how can I correct load that into my SQLServer? (I gues use DATABASE RESTORE but I'm not sure)
Thank you for everthing answers!
--
"Success is simple. Do what's right, the right way, at the right time."
best regards,
tradakad
|
|
|
|
|
If you google for it, you should be able to find it as a download. I'm not sure what form it comes in, if it's scripts you run, a DB file you attach, or a backup that you restore to. I'm sure the download page would tell you, tho.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I wanted to edit a grid view column using a checkbox control,so i have used a template column and placed a checkbox control in the edit item template,and set the bind property for item control.but in the following event i am unable to identify the checked status of the control.
<br />
protected void ReportView_RowUpdating(object sender, GridViewUpdateEventArgs e)<br />
{<br />
<br />
<br />
<br />
<br />
<br />
GridViewRow row = ReportView.Rows[e.RowIndex];<br />
row.RowState = DataControlRowState.Edit;<br />
CheckBox chk1 = ((CheckBox)row.FindControl("CheckBox1"));<br />
Response.Write(chk1.Text + chk1.Checked.ToString());<br />
if (row != null)<br />
{<br />
bool isChecked = ((CheckBox)row.FindControl("CheckBox1")).Checked;<br />
<br />
<br />
if (isChecked)<br />
{<br />
<br />
Response.Write("The Text Entered is" +((CheckBox)row.FindControl("CheckBox1")).Text);<br />
<br />
}<br />
ReportView.EditIndex = -1;<br />
<br />
BindData(); <br />
<br />
<br />
}<br />
<br />
}<br />
here the checked status is not identified ie even if the check box is checked,the status is always false,but it is identifying the checkbox control
.the text value is correct ,but the checked status is always false,
please help with a solution
-- modified at 4:08 Tuesday 20th February, 2007
|
|
|
|
|
use the following code where u do the checking:
if((CheckBox)(dg.Items(i).Cells(0).FindControl("ChkBox").Checked)
{
//you code goes here
}
where i would be the iterating variable indicating the row index of the datagrid (ie. dg) and the CheckBox control is assumed to be in the first column ie. Cessl(0) and the CkeckBox control name is assumed to be "ChkBox"
hope that helps.
|
|
|
|
|
hi thanks for ur reply
but again even if the control is identified ,the checked status is always given as false
should i give anything else to bind the checkedchange event
thanks
|
|
|
|
|
this is because every time the page load event is triggered, the datagrid gets a new data.
to avoid this you should check the ispostback property.
see a very simple example below:
private void Page_Load(object sender, System.EventArgs e)
{
if (!Page.IsPostBack)
BindDG();
}
public void BindDG()
{
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("user id=sa;password=sa;initial catalog=test;data source=192.168.111.30");
System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand();
cmd.CommandText="select *from users";
DataSet ds = new DataSet();
System.Data.SqlClient.SqlDataAdapter da = new System.Data.SqlClient.SqlDataAdapter(cmd);
da.Fill(ds);
dg.DataSource=ds;
dg.DataBind();
}
private void BtnDel_Click(object sender, System.EventArgs e)
{
string objName;
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection("user id=sa;password=sa;initial catalog=test;data source=192.168.111.30");
System.Data.SqlClient.SqlCommand cmd = conn.CreateCommand();
conn.Open();
for (int i=0; i
|
|
|
|
|
thank you, let me check this method...
sebastian
|
|
|
|
|
Thank you very much,it worked successfully.
|
|
|
|
|
Hi,
Is it possible to insert data into datagrid with out getting the data from a database like sql or access.
Thanks.
|
|
|
|
|
you can create a simple array and bind that to the datagrid as well.
|
|
|
|
|
Thank you,
I'm not so sure to have understood How you tried to explain to me.
Thanks
|
|
|
|
|
I've decided to use sql but I'm having problem with seeing my datagrid? Yet I set Property visible to true what could be the Problem
Thanks.
|
|
|
|
|
you might not have called the databind() function of the datagrid.
|
|
|
|
|
For sure I did call the databind() That's why I find it strange do you think I'missing something else?
|
|
|
|
|
did you set the "data source" and "data member" for it ?
then u should use data bind .
|
|
|
|
|
for the datagrid to display data, it need to have some data in. this data can be of any type, dataset,table, array of userdefined class, etc.
so, if u need to display data in the datagrid which is not from any database, create a class of your choice, declare its array, add values to the array, add that object ot the datasource of the datagrid then bind the data by calling databind().
hope this makes it more clear
|
|
|
|
|
Grid can be bound to any Collection type.
You can create a dummy datattable as following:-
DataTable dt = new DataTable("Try");
dt.Columns.Add("column1");
dt.Rows.Add("one");
dt.Rows.Add("two");
dt.Rows.Add("three");
and now set the datasource to dt.
Also you need to have atleast 1 row in datasource to get the grid displayed
Nana
|
|
|
|
|
Thank you,
I was doing it like this. Hope
private void Page_Load(object sender, System.EventArgs e)
{
if (! IsPostBack)
{
BindDataGrid();
}
}
private void BindDataGrid()
{
SqlCommand myCommand=new SqlCommand("SELECT * from Billing",con);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds=new DataSet();
myAdapter.Fill(ds);
con.Open();
myCommand.ExecuteNonQuery();
dgbilling.DataSource=ds;
dgbilling.DataBind();
con.Close();
}
I had ever used this same code on another program and it worked properly.
could you help me from there please
Thanks.
|
|
|
|
|
use following code-
SqlDataAdapter myAdapter=new SqlDataAdapter("SELECT * from Billing", con);
con.Open();
DataSet ds=new DataSet();
myAdapter.Fill(ds);
con.Close();
dgbilling.DataSource=ds;
dgbilling.DataBind();
you dont need sqlcommand here at all.
And one suggestion - read more about what is an adapter, dataset etc why is it used n all.
I think one should know why is he/she using the object in the code.
Nana
|
|
|
|
|
Thanks for the advice. But the datagrid cannot appear,
|
|
|
|
|
is the qurey returning records?
Whats the count of rows in datasource?
Nana
|
|
|
|
|
In the datasource there is nonthing..
Thanks
|
|
|
|
|
when you use data adapters you do not need to open or close the connection, it does it by itselt. if the connection was already open before calling the fill command in data-adapert, it will leave it open and if it was close, it will open it get the data and then close it.
the Fill() function will get the data; so, you do not need to call the ExecuteNonQuery()
command again.
you might try the following:
private void BindDataGrid()
{
SqlCommand myCommand=new SqlCommand("SELECT * from Billing",con);
SqlDataAdapter myAdapter=new SqlDataAdapter(myCommand);
DataSet ds=new DataSet();
myAdapter.Fill(ds);
dgbilling.DataSource=ds;
dgbilling.DataBind();
}
this should give the required result.
|
|
|
|
|
GOD BLESS U
Dear Friends,
i am using a datagrid control in my ASP.NET application .
The datagrid has a checkbox column in it.Now apart from this the page also contains a button control named Delete.
what i need here is that when a user selects the checkbox in the datagrid,
and clicks the Delete button then that record should be deleted from both datagrid & database.
But if the user checks the SELECT ALL checkbox which is present in the datagrid header and clicks the delete button then all the records should be deleted from the datagrid & database.
pl give me the code for the above problem
This functionality is similar to any inbox page .
Pl kindly help me
Thanks a lot
Have a good day
Arun Hegde
-- modified at 4:28 Tuesday 20th February, 2007
|
|
|
|