|
You need to use a javascript timer to redirect the user. The Session End Event does not fire on a postback so the browser is not redirected. The Session End Event usually occurs when a "session" hasn't posted back in 20 minutes or however long.
|
|
|
|
|
Another way is
create a thread that will check Session is there or not
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
Thats great, and how would you propose to redirect the user from this thread?
|
|
|
|
|
Hi,
My issue is related to getting data in gridview when I selected a row. Because Always the value comes "".
Firstly I bind the dataset to gridview in code-behind. I didn't use sqldatasource. and in html code about gridview is below(between asp gridview tag):
ID="grd_getdata" runat="server"
OnSelectedIndexChanged="grd_getdata_SelectedIndexChanged"
AutoGenerateColumns="False" DataKeyNames="No">
<columns>
<asp:boundfield datafield="No" headertext="No" readonly="True">
and selectedindexchangedevent code is;
protected void grd_getdata_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = grd_getdata.SelectedRow;
Session["aksesuar"] = row.Cells[0].Text;
}
So the value of row.Cells[0].Text always comes empty. On the other hand I see the value on gridview. Why couldn't I get the value? Where is the wrong?
I hope you know the answer!!! Keep Battling.
|
|
|
|
|
What I like to do to avoid issues with the cell numbers is to use mostly template columns. If you want to reference values in a gridview row, use a template column and the row's findControl method.
<br />
Label lbl = row.findControl(LabelID);<br />
Session["aksesuar"] = lbl.Text;<br />
|
|
|
|
|
Then Your approaches is mostly correct ways!!!
Is this only solution? and Is the html code correct? DoI need the datakeynames in html code?
Thanks for your reply...
|
|
|
|
|
No you don't need datakeynames and I'm not going to say my way is most correct. Every method has advantages / limitations. This is just how I do it.
<br />
<br />
public void GridViewRowDataBound(Object sender, System.Web.UI.WebControls.GridViewRowEventArgs e)
{<br />
if (e.Row.RowType == DataControlRowType.DataRow)<br />
{ <br />
Button btn = (Button) e.Row.FindControl("btnYourButton");<br />
TextBox txt = (TextBox) e.Row.FindControl("btnYourTextBox") ;<br />
DataRowView drv = (DataRowView) e.Row.DataItem; <br />
btn.CommandArgument = drv["ID"].ToString();<br />
}<br />
}<br />
<br />
protected void btnYourBUtton_Click (object sender, EventArgs e)<br />
{<br />
<br />
Button btn = (Button) sender;<br />
GridViewRow gvr = (GridViewRow)btn.NamingContainer;<br />
TextBox txt = (TextBox) gvr.FidnControl("btnYourTextBox");<br />
<br />
<br />
}<br />
<br />
<br />
That is just how I would code it, not necessarily the best method.
|
|
|
|
|
Hi ToddHileHoffer,
You're super coder. If your solution is the best, I will use it.
Because it works.
Is this the best way to get value from selected row???
Keep Battling
|
|
|
|
|
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
|
|
|
|
|
|
This is generral error given by SQL Server 2005
There might be any reasone for it
I also faced this problem few days before i tried everything then also it was showing same error
At last i switch OFF the Fire Wall of the operating System of the server then it allowed me
Thanks and Regards
Sandeep
If you want something you never had,
do something you have never done!
|
|
|
|
|
An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
rami abd alhalim
|
|
|
|
|
I presume you want to know how to allow a remote connection.
* Open up the SQL Server Configuration Manager.
* In the tree on the left open SQL Server 2005 Network Configuration
* Select "Protocols for [Name of instance]" as apropriate
* On the right you'll see a list of protocols. Ensure that TCP/IP is enabled.
|
|
|
|
|
enabled TCP/IP :the same Error
in SQL Server 2000 not 2005
|
|
|
|
|
can any body tell me how to get the Clients running Operating System
through the Request.form object i do not get the exact OS
please help me...Very Quickly
thanx
|
|
|
|
|
There is an operatingSystem object that has Platform, servicepack, version and versionstring.
Here is an example straight from Microsoft help:
Visual Basic
' Example for the OperatingSystem constructor and the
' OperatingSystem.ToString( ) method.
Imports System
Imports Microsoft.VisualBasic
Module OpSysConstructDemo
' Create and display an OperatingSystem object.
Sub BuildOSObj( pID As PlatformID, ver As Version )
Dim os As New OperatingSystem( pID, ver )
Console.WriteLine( " {0}", os.ToString( ) )
End Sub
Sub BuildOperatingSystemObjects( )
' The Version object does not need to correspond to an
' actual OS version.
Dim verNull As New Version( )
Dim verMajMin As New Version( 3, 11 )
Dim verMMBld As New Version( 5, 25, 625 )
Dim verMMBVer As New Version( 5, 6, 7, 8 )
Dim verString As New Version( "3.5.8.13" )
' All PlatformID members are shown here.
BuildOSObj( PlatformID.Win32NT, verNull )
BuildOSObj( PlatformID.Win32S, verMajMin )
BuildOSObj( PlatformID.Win32Windows, verMMBld )
BuildOSObj( PlatformID.WinCE, verMMBVer )
BuildOSObj( PlatformID.Win32NT, verString )
End Sub
Sub Main( )
Console.WriteLine( _
"This example of the OperatingSystem constructor " & _
"and " & vbCrLf & "OperatingSystem.ToString( ) " & _
"generates the following output." & vbCrLf )
Console.WriteLine( _
"Create and display several different " & _
"OperatingSystem objects:" & vbCrLf )
BuildOperatingSystemObjects( )
Console.WriteLine(vbCrLf & _
"The OS version of the host computer is: " & _
vbCrLf & vbCrLf & " {0}", _
Environment.OSVersion.ToString( ) )
End Sub
End Module
' This example of the OperatingSystem constructor and
' OperatingSystem.ToString( ) generates the following output.
'
' Create and display several different OperatingSystem objects:
'
' Microsoft Windows NT 0.0
' Microsoft Win32S 3.11
' Microsoft Windows 98 5.25.625
' Microsoft Windows CE 5.6.7.8
' Microsoft Windows NT 3.5.8.13
'
' The OS version of the host computer is:
'
' Microsoft Windows NT 5.1.2600.0
C#
using System;
class OpSysConstructDemo
{
static void BuildOSObj( PlatformID pID, Version ver )
{
OperatingSystem os = new OperatingSystem( pID, ver );
Console.WriteLine( " {0}", os.ToString( ) );
}
static void BuildOperatingSystemObjects( )
{
Version verNull = new Version( );
Version verMajMin = new Version( 3, 11 );
Version verMMBld = new Version( 5, 25, 625 );
Version verMMBVer = new Version( 5, 6, 7, 8 );
Version verString = new Version( "3.5.8.13" );
BuildOSObj( PlatformID.Win32NT, verNull );
BuildOSObj( PlatformID.Win32S, verMajMin );
BuildOSObj( PlatformID.Win32Windows, verMMBld );
BuildOSObj( PlatformID.WinCE, verMMBVer );
BuildOSObj( PlatformID.Win32NT, verString );
}
public static void Main( )
{
Console.WriteLine(
"This example of the OperatingSystem constructor " +
"and \nOperatingSystem.ToString( ) " +
"generates the following output.\n" );
Console.WriteLine(
"Create and display several different " +
"OperatingSystem objects:\n" );
BuildOperatingSystemObjects( );
Console.WriteLine(
"\nThe OS version of the host computer is:\n\n {0}",
Environment.OSVersion.ToString( ) );
}
}
Hope that helps.
Ben
|
|
|
|
|
i am filling a datagrid based on 3 conditions.sometimes based on id or name or without conditions. i am using 3 query for that and i am filling data to a dataset that is declared as static .
in pageindex chaged event when i write like this
Datagrid.datasource=static dataset
datagrid.databind()
is showing error like this
" ilstsource does not contain any datasources "
can't i directly assign my static dataset to datagrid?
|
|
|
|
|
I don't know if you can or not. It doesn't really make sense to do this though.
Just add one more line of code.
<br />
DataSet dst = YourStaticClass.GetDataSet();<br />
DataGrid.dataSource = dst;<br />
DataGrid.dataBind;<br />
|
|
|
|
|
Hi,
I have a datagrid that Inserts data into sql datbase, and amongest
there is a column that has a radiobuttonlist, the radiobuttonlist
contains two radiobuttons one with Good Mood and the otherone with bad
moods. In the column I placed two images where one shows a happy face
and the other one a sad face and I want when a user selects
radiobutton Good Mood the image with a happy face is inserted. but I'm
having a problem when I select radiobutton Good Mood I only get Good
Mood inserted but not the image. How should I do this? here is the
code I'm using:
DataTable table = new DataTable();
private DataTable Fill()
{
SqlDataAdapter adapter = new SqlDataAdapter("select * from
dbo.DashBoard", con);
adapter.Fill(table);
return table;
}
private void Bind()
{
dgis.DataSource = table;
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(), 0);
}
private void dgis_ItemCommand(object
source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
// stop editing
dgis.EditItemIndex = -1;
switch (e.CommandName)
{
case "Insert":
break;
case "Update":
System.Web.UI.WebControls.TextBox st=new
System.Web.UI.WebControls.TextBox();
st=(System.Web.UI.WebControls.TextBox)e.Item.Cells[6].FindControl("txtobjach");
System.Web.UI.WebControls.TextBox st1=new
System.Web.UI.WebControls.TextBox();
st1=(System.Web.UI.WebControls.TextBox)e.Item.Cells[5].FindControl("txtobj");
System.Web.UI.WebControls.TextBox st2=new
System.Web.UI.WebControls.TextBox();
st2=(System.Web.UI.WebControls.TextBox)e.Item.Cells[4].Controls[0];
System.Web.UI.WebControls.TextBox st3=new
System.Web.UI.WebControls.TextBox();
st3=(System.Web.UI.WebControls.TextBox)e.Item.Cells[3].Controls[0];
System.Web.UI.WebControls.TextBox st4=new
System.Web.UI.WebControls.TextBox();
st4=(System.Web.UI.WebControls.TextBox)e.Item.Cells[2].Controls[0];
System.Web.UI.WebControls.RadioButtonList st5=new
System.Web.UI.WebControls.RadioButtonList();
st5=(System.Web.UI.WebControls.RadioButtonList)e.Item.Cells[1].FindControl("rblmood");
System.Web.UI.WebControls.Image imgDaily = new
System.Web.UI.WebControls.Image();
imgDaily=(System.Web.UI.WebControls.Image)e.Item.Cells[1].FindControl("imgm");
System.Web.UI.WebControls.TextBox st6=new
System.Web.UI.WebControls.TextBox();
st6=(System.Web.UI.WebControls.TextBox)e.Item.Cells[0].FindControl("txtname");
SqlCommand myCommand=new SqlCommand();
myCommand.Connection=con;
myCommand.CommandText="insert into DashBoard
(ObjectiveAchieved,Objective,MoodToday,Name) values
(@ObjectiveAchieved, @Objective,@MoodToday,@Name)";
myCommand.Parameters.Add(new
SqlParameter("@ObjectiveAchieved",SqlDbType.Text));
myCommand.Parameters["@ObjectiveAchieved"].Value=st.Text;
myCommand.Parameters.Add(new
SqlParameter("@Objective",SqlDbType.Text));
myCommand.Parameters["@Objective"].Value=st1.Text;
myCommand.Parameters.Add(new SqlParameter("@Workinghrs",SqlDbType.Char,
45));
myCommand.Parameters["@Workinghrs"].Value=st2.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedout",SqlDbType.Char,
45));
myCommand.Parameters["@Loggedout"].Value=st3.Text;
myCommand.Parameters.Add(new SqlParameter("@Loggedin",SqlDbType.Char,
45));
myCommand.Parameters["@Loggedin"].Value=st4.Text;
myCommand.Parameters.Add(new
SqlParameter("@MoodToday",SqlDbType.Text));
myCommand.Parameters["@MoodToday"].Value=st5.SelectedValue;
myCommand.Parameters.Add(new SqlParameter("@Name",SqlDbType.Text));
myCommand.Parameters["@Name"].Value=st6.Text;
if(e.Item.Cells[1].Equals("Good Mood"))
{
imgDaily.ImageUrl = "IS_dashboard/Moods/laughing.gif";
}
else
{
imgDaily.ImageUrl = "IS_dashboard/Moods/sad.gif";
}
con.Open();
myCommand.ExecuteNonQuery();
con.Close();
dgis.EditItemIndex=-1;
BindDataGrid();
break;
case "Cancel":
break;
case "Edit":
dgis.EditItemIndex = e.Item.ItemIndex;
EditCommandColumn ecc = (EditCommandColumn) dgis.Columns[7];
ecc.UpdateText = "Insert";
break;
}
Fill();
InsertEmpty();
Bind();
}
protected void rblmood_SelectedIndexChanged(object sender,
System.EventArgs e)
{
RadioButtonList rbl = (RadioButtonList)sender;
Control parent = rbl.Parent;
while(!(parent is System.Web.UI.WebControls.DataGridItem))
{
parent = parent.Parent;
}
}
protected int SetState(object st)
{
string state = st.ToString();
if(state.Equals("True"))
{
return 0;
}
else
{
return 1;
}
}
Thanks.
|
|
|
|
|
hi I have not done anything like this but I think I can try.I have done similiar but using checkbox, but I just need to check or uncheck the checkbox u can do the same for radion button.
U can use this:
<asp:TemplateField HeaderText="Modify">
<ItemStyle HorizontalAlign="Center" Width="50px" />
<HeaderStyle Width="70px" CssClass="heading" />
<ItemTemplate>
<asp:CheckBox ID="chkModify" runat="server" AutoPostBack=true OnCheckedChanged="chkModify_Changed" />
</ItemTemplate>
</asp:TemplateField>
Dim ml_blnflagView As Boolean = False
For intGridRowcounter = 0 To GridViewForm.Rows.Count - 1
If CType(GridViewForm.Rows(intGridRowcounter).FindControl("chkModify"), CheckBox).Checked = False Then
ml_blnflagModify = True
'Exit For
Else
'If cboUserName.SelectedIndex = 0 Then
' CType(GridViewForm.Rows(intGridRowcounter).FindControl("chkUpdate"), CheckBox).Checked = False
' Hidden2.Value = 1
' Exit Sub
'End If
CType(GridViewForm.Rows(intGridRowcounter).FindControl("chkView"), CheckBox).Checked = True
End If
If CType(GridViewForm.Rows(intGridRowcounter).FindControl("chkView"), CheckBox).Checked = True Then
ml_blnflagView = True
'Exit For
Else
ml_blnflagView = False
End If
Next
If ml_blnflagModify = True Then
chkAllModify.Checked = False
chkAllPermission.Checked = False
Else
chkAllModify.Checked = True
chkAllView.Checked = True
AllPermission()
'chkAllPermission.Checked = True
End If
If ml_blnflagView = False Then
chkAllView.Checked = False
chkAllPermission.Checked = False
End If
If chkAllAdd.Checked = True And chkAllModify.Checked = True And chkAllDelete.Checked = True And chkAllView.Checked = True And chkAllPrint.Checked = True Then
chkAllPermission.Checked = True
End If
End Sub
Hope this helps u...
All the best...
|
|
|
|
|
Thanks varshavmane,
I'm tring your example but i'm having a problem you are using VB and I use C# Could you make it in C#?
Thank you.
|
|
|
|
|
Hi All,
1)i am getting Error "Load Report Failed ".when i try to run a CrystalReport.Pls tell me how to solve this problem.
2) And also tell me how to pass parameters to a Report
3) How to run Totals and SubTotals in Crystal Report.
if possible pls send code to my mail id
pusnsuresh@yahoo.com
Thanks
|
|
|
|
|
siddisagar wrote: 1)i am getting Error "Load Report Failed ".when i try to run a CrystalReport.Pls tell me how to solve this problem.
you might not given the report path properly
siddisagar wrote: 2) And also tell me how to pass parameters to a Report
search crystal report push method in code project
siddisagar wrote: 3) How to run Totals and SubTotals in Crystal Report.
on the report, right click on the page footer or report footer then select subtotal or total then choose the filed which you want to sum
Regards,
Sylvester G
sylvester_g_m@yahoo.com
|
|
|
|
|
i want to implement the functionality of remember me checkbox which is usually there on login form whereby the computer remembers the username and encrypted password for user next visit on that page through cookies.
Can anyone pls help me out .
its urgent
thanks in advance.
|
|
|
|
|