|
you should tell your client that they are not free to invent any functionality and expect it to be possible and that as you know nothing about ASP.NET, you're not a good person to ask. Then you should read the sticky post at the top of the forum on how to ask questions. 'hai' is not a useful subject line.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have used an http handler in my website.This works fine on my local PC.But fails to work on IIS.
Can anyone help me solve this issue?
Thanks and Regards
ARINDAM
|
|
|
|
|
Well, you haven't provided any information about the HttpHandler or you IIS settings, version etc. Here is my thoughts
1 - Check the web.config entry.
2 - If HTTPHandler is handling any extensions that is not processed by ASP.NET, make sure the extension is added to the IIS ISAPI extension list.
3 - If in IIS7, you need to do some more changes in the settings. Let me know if you are using IIS7.
|
|
|
|
|
Hi all
Am trying to do the sorting through coding
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
Dim sortExpression As String = e.SortExpression
If e.SortDirection = SortDirection.Ascending Then
e.SortDirection = SortDirection.Descending
GridView1.Sort(sortExpression, SortDirection.Descending)
Else
e.SortDirection = SortDirection.Ascending
GridView1.Sort(sortExpression, SortDirection.Ascending)
End If
UDF_SetMasterData()
UDF_SetGridData()
end sub
but am getting an error like this:
An unhandled exception of type 'System.StackOverflowException' occurred in System.Web.dll
and if i try to put a break point and check,the loop is continuing within the same Gridview1_sorting..
Anybody knows what acn be the reason?
|
|
|
|
|
your commandline calling GridView.Sort(.....) is the problem. If you would do a debug and would step into this line with F11, then you will notice you have created a recursive call to the method you are in. And then it reaches the point it has too many calls and then your error peeps up.
You shoud create a dataview that holds the sorted data after the users hits its request for a sort on the data.
|
|
|
|
|
ok...den can u tel me how can i do that?...
|
|
|
|
|
If you would take a look at this article: http://www.codeproject.com/KB/grid/GenericGridView.aspx[^]">. You'll see it is not that hard to build.
|
|
|
|
|
Thanks a lot...Now sorting is happening in my gridview..but the problem is if i click on same column second time sorting is not happening...
on the first click it will sort as descending...and again i click on same column it should sort as ascending...but not happening...
but if i click any other column and come back to this its working fine...
what can be the reason?
|
|
|
|
|
Is your value for ascending/descending for the column stored in a session variable?
If not, than do so. When u see the page it is in disconnected state, so the website does not memorize the local variables only the session variables.
good luck
|
|
|
|
|
Sorry i didnt get u....
My code is here
Protected Sub GridView1_Sorting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSortEventArgs) Handles GridView1.Sorting
'Retrieve the name of the clicked column (sort expression)
Dim pageindex As Integer
pageindex = GridView1.PageIndex
Dim sortExpression As String = e.SortExpression
'Decide and save the new sort direction
If (sortExpression = e.SortExpression) Then
If gridSortDirection = SortDirection.Ascending Then
gridSortDirection = SortDirection.Descending
Else
gridSortDirection = SortDirection.Ascending
End If
Else
gridSortDirection = WebControls.SortDirection.Ascending
End If
Me.DsRefMaster1.Tables(Me.HdnProcessingTable.Value).DefaultView.Sort = sortExpression
Me.DvProcessing = Me.DsRefMaster1.Tables(Me.HdnProcessingTable.Value).DefaultView
UDF_SetMasterData()
UDF_SetGridData()
GridView1.PageIndex = pageindex
End Sub
Private Property gridSortDirection()
Get
'Initial state is Ascending
If (ViewState("GridSortDirection") Is Nothing) Then
ViewState("GridSortDirection") = SortDirection.Ascending
End If
'Return the state
Return ViewState("GridSortDirection")
End Get
Set(ByVal value)
ViewState("GridSortDirection") = value
End Set
End Property
|
|
|
|
|
Hi,
I am not a VB-code but a CSharpcoder (as a little warning)
You State: If (sortExpression = e.SortExpression) Then
How dus this check your ViewState("GridSortDirection") ?
|
|
|
|
|
I have put that gridSortDirection as private property na...check the second function...
Private Property gridSortDirection()
Get
'Initial state is Ascending
If (ViewState("GridSortDirection") Is Nothing) Then
ViewState("GridSortDirection") = SortDirection.Ascending
End If
'Return the state
Return ViewState("GridSortDirection")
End Get
Set(ByVal value)
ViewState("GridSortDirection") = value
End Set
End Property
|
|
|
|
|
If i click on the second time its giving an Error like this:
Sys.InvalidOperation Exception ScriptLoader.load script cannot be called while the script loader is already loading scrips
|
|
|
|
|
do you use the if Page.IsPostback Then construction?
If that is false only then you should call your property.
This is due to AJAX
also check your code:
If (sortExpression = e.SortExpression) Then
If gridSortDirection = SortDirection.Ascending Then
gridSortDirection = SortDirection.Descending
Else
gridSortDirection = SortDirection.Ascending
End If
Else
gridSortDirection = WebControls.SortDirection.Ascending
End If
what are the values in a debug of:
sortExpression, gridSortExpression
and what path does it run in the if sections?
|
|
|
|
|
this is my design code
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login page.aspx.cs" Inherits="Login_page" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>WebForm1</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<!-- <summary>
||||| Style Sheet |||||
</summary>
--><link title="standard" href="Styles.css" type="text/css" rel="stylesheet">
</head>
<body>
<!-- ||||| Login Form ||||| -->
<form id="frmlogin" method="post" runat="server">
<table id="mainTable" border="0" style="left: 368px; position: relative; top: 177px">
<tr>
<td>
<table class="t_border" id="loginTable" cellspacing="15" cellpadding="0" style="left: -1px; position: relative; top: 12px">
<tr>
<td style="height: 24px"><b>Login: </b>
</td>
<td style="height: 24px"><asp:textbox id="txtUserName" runat="server" width="160px"></asp:textbox></td>
</tr>
<tr>
<td><b style="position: relative">Password: </b>
</td>
<td><asp:textbox id="txtPassword" runat="server" width="160px" textmode="Password"></asp:textbox></td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="height: 21px; position: relative;">
<asp:Label ID="Label3" runat="server" Font-Size="Large" Style="left: 5px; position: relative;
top: -3px" Text="Selcet Center"></asp:Label>
<asp:DropDownList ID="DropDownList1" runat="server" style="left: 6px; position: relative; top: 1px">
<asp:ListItem>Select Type</asp:ListItem>
<asp:ListItem>Service Center</asp:ListItem>
<asp:ListItem>Call Center</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td style="height: 21px"><asp:Label ID="Label4" runat="server" Font-Size="Large" Text="Select Zone" style="left: 5px; position: relative; top: 0px" Width="97px"></asp:Label>
<asp:DropDownList ID="DropDownList2" runat="server" Width="111px" style="left: 5px; position: relative; top: -1px">
<asp:ListItem>Select Zone</asp:ListItem>
<asp:ListItem>West Zone</asp:ListItem>
<asp:ListItem>North Zone</asp:ListItem>
<asp:ListItem>South Zone</asp:ListItem>
<asp:ListItem>Other</asp:ListItem>
</asp:DropDownList></td>
</tr>
<tr>
<td align="center" colspan="2"><asp:button id="Button1" runat="server" text="Submit" borderstyle="Solid" OnClick="Button1_Click1"></asp:button></td>
</tr>
</table>
</form>
<asp:label id="lblMessage" runat="server" width="288px" font-bold="True" font-italic="True"
font-size="Medium" forecolor="#C00000" style="left: -2px; position: relative; top: 286px"></asp:label>
<asp:label id="lblMessage2" runat="server" width="288px" font-bold="True" font-italic="True"
font-size="Medium" forecolor="#C00000" style="left: -289px; position: relative; top: 259px"></asp:label>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TOSHIBA1ConnectionString %>"
SelectCommand="SELECT [First_Name], [LOGIN_Id], [Password] FROM [Users]"></asp:SqlDataSource>
<!-- ||||| End of Form ||||| -->
</body>
</html>
i am getting the error in the data base connection it showing that u have not initilize the data base connection
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
public partial class Login_page : System.Web.UI.Page
{
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
#region Web Form Designer generated code
#endregion
protected void Button1_Click1(object sender, EventArgs e)
{
if (Page.IsValid)
{
if (DBConnection(txtUserName.Text, txtPassword.Text))
{
FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, false);
Response.Redirect("wellcome.aspx");
}
else
{
lblMessage.Text = "Invalid Login, please try again!";
}
}
}
private bool DBConnection(string txtUser, string txtPass)
{
SqlConnection myConn = new SqlConnection(System.Configuration.ConfigurationManager.AppSettings["<%$ ConnectionStrings:TOSHIBA1ConnectionString %>"]);
SqlCommand myCmd = new SqlCommand("sp_ValidateUser", myConn);
myCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter returnParam;
objParam1 = myCmd.Parameters.Add("[LOGIN_Id]", SqlDbType.VarChar);
objParam2 = myCmd.Parameters.Add ("[Password]", SqlDbType.VarChar);
returnParam = myCmd.Parameters.Add("[First_Name]", SqlDbType.VarChar);
objParam1.Direction = ParameterDirection.Input;
objParam2.Direction = ParameterDirection.Input;
returnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = txtUser;
objParam2.Value = txtPass;
try
{
if (myConn.State.Equals(ConnectionState.Closed))
{
myConn.Open();
myCmd.ExecuteNonQuery();
}
if ((int)returnParam.Value < 1)
{
lblMessage.Text = "Invalid Login!";
return false;
}
else
{
myConn.Close();
return true;
}
}
catch (Exception ex)
{
lblMessage2.Text = ex + "Error Connecting to the database";
return false;
}
}
}
|
|
|
|
|
What line did you get your error on? Have you got a connection string in the config file?
|
|
|
|
|
Nothing understandable. Please post properly
|
|
|
|
|
Go to your admissions office, hand them back your student ID and tell them you're too stupid to be on this course. Then go home stand in front of a mirror and repeat these lines 100 times "Would you like fries with that, Sir".
|
|
|
|
|
Just to add, it's idiots like you that are killing our industry, especially when you start taking jobs through sites like rentacoder and cause end users to assume that this level of cluelessness is what our industry is about. If this is not homework, but a paid job, then contact the client, tell them you were stealing from them, and return their deposit.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
...
"Well, we're getting "F"'d at work. WPF, WCF, and WWF... WTF?" --John Simmons
|
|
|
|
|
i have parent datagrid and a child datagrid nxt row of everydataitem. when i click the expand button in parent dg the child dg will be shown.
my problem is when i clicked edit button or any button in child datagrid my parent datagrid collapse. how can i maintain the expanded child datagrid?
this is my code snippet
<code><script type="text/javascript">
function expandcollapse(obj){
var div = document.getElementById(obj);
var img = document.getElementById('img' + obj);
if (div.style.display == "none"){
div.style.display = "block";
img.src = "images/collapse.gif";
img.alt = "Close to view sub menus";
}else{
div.style.display = "none";
img.src = "images/expand_blue.gif";
img.alt = "Expand to show sub menus";
}
}
</script>
<asp:datagrid id="grdMenu" runat="server" width="830px" autogeneratecolumns="False">
<columns>
<asp:templatecolumn headertext="Menu Title" sortexpression="mainmenuid">
<itemtemplate>
<asp:label id="lblmenutitle" runat="server" />
</itemtemplate>
</asp:templatecolumn>
<asp:templatecolumn>
<itemtemplate>
<a href="javascript:expandcollapse('div<%# Eval(" mainmenuid=") %>');">
<img id="imgdiv<%# Eval(" mainmenuid=") %>" src="images/expand_blue.gif" /></a>
<tr><td colspan="100%">
<div id="div<%# Eval(" mainmenuid=") %>">
style="display:none;position:relative;left:25px;OVERFLOW: auto;WIDTH:98%;" >
<asp:datagrid id="grdSub" runat="server" autogeneratecolumns="False" cssclass="InputText" datakeyfield="mainmenuid" onpageindexchanged="ChangeIndex2" ondeletecommand="grdSub_DeleteCommand" onupdatecommand="grdSub_UpdateCommand" oneditcommand="grdSub_EditCommand" onsortcommand="grdSub_SortCommand" onitemdatabound="grdSub_ItemDataBound">
<columns>
<asp:templatecolumn headertext="SubmenuTitle">
<itemtemplate>
<asp:label id="lblparentid" runat="server" />
</itemtemplate>
</asp:templatecolumn> <asp:templatecolumn> <itemtemplate><asp:imagebutton id="ImageButton6" runat="server" imageurl="~/images/edit.gif" commandname="Edit" causesvalidation="false"></asp:imagebutton>
</itemtemplate></asp:templatecolumn>
</columns></asp:datagrid>
</div></td></tr></itemtemplate>
</asp:templatecolumn>
</columns></asp:datagrid></code>
thanks in advance.
|
|
|
|
|
Hi,
I am using the Infragistics calendar view control for displaying the booking activity...
I need to pass the date & time along with the parameter from the parent page to the child page.
Please help me in fetching the date & time through javascript and pass it as a parameter to the child window.
Thanks for your quick response.
Regards
Priya
|
|
|
|
|
Please guide me if any one have any solution.
|
|
|
|
|
I have a datagrid with AutoGenerateColumns="True". I also have 3 template columns in the datagrid. One with a checkbox for multiple selection of rows.
Now I need to iterate through the grid to know which are the rows selected.
But when I try to iterate like below:
foreach(DataGridItem i in grdResults.Items)
{
bool bChecked = ((CheckBox)i.FindControl("chkSelect")).Checked;
if(bChecked == true)
{
string locationTxt = ((TextBox)i.FindControl("txtLocation")).Text;
}
}
grdResults.Items gives "error: cannot obtain value"
I am not sure what is going wrong. I want to use autogeneratecolumns since the datasource is bound to ds.tables[2] and template columns since some of the data is bound to ds.tables[0] and tables[1].
Please help. Thanks in advance.
|
|
|
|
|
you better do a
foreach (Datarow row in grdResults.Rows)
you scan all the rows in the gridview.
than do a row.FindControl(). What you do now is checking each item and if the item is chkSelect. If it is not chkSelect you have a null reference. Only 1 item in each row is chkSelect, not all items in the grid can be chkSelect.
|
|
|
|