vedant0500
asked on
Problem with .ashx file
Hi
i am using autocomplete/autosuggest textbox which reside in usercontrol form.
My problem is that it when i drag this user control to anyother page in any other directory it does not work but when dragged in same directory where my usercontrol page reside it works fine
I think it the issue related with directory but i changed the .ashx file path but still does not work
Below is the code which works fine when kept in a same directory let's say "abc"
means it contains 3 files
1. .aspx page
2. .ashx page
3. .ascx page
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:SearchBox ID="SearchBox1" runat="server" />
</div>
</form>
</body>
</html>
but when i drag the user control to anyother page which is in another directory lets say "xyz"
which contains
only my .aspx page
in that scenario it does not work
below is my .ascx file in which my logic reside
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SearchBox.ascx.c s" Inherits="SearchBox" %>
<link href="scripts/jquery.autoc omplete.cs s" rel="stylesheet" type="text/css" />
<script src="scripts/jquery-1.4.1. min.js" type="text/javascript"></s cript>
<script src="scripts/jquery.autoco mplete.js" type="text/javascript"></s cript>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=txtSearch.ClientID% >").autoco mplete('Search_CS.ashx');
});
</script>
<style type="text/css">
.abcd
{
width: 130px;
}
</style>
<div class="abcd">
<asp:TextBox ID="txtSearch" runat="server" AutoCompleteType="Disabled "></asp:Te xtBox>
</div>
please help on the same,Thanks
i am using autocomplete/autosuggest textbox which reside in usercontrol form.
My problem is that it when i drag this user control to anyother page in any other directory it does not work but when dragged in same directory where my usercontrol page reside it works fine
I think it the issue related with directory but i changed the .ashx file path but still does not work
Below is the code which works fine when kept in a same directory let's say "abc"
means it contains 3 files
1. .aspx page
2. .ashx page
3. .ascx page
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:SearchBox ID="SearchBox1" runat="server" />
</div>
</form>
</body>
</html>
but when i drag the user control to anyother page which is in another directory lets say "xyz"
which contains
only my .aspx page
in that scenario it does not work
below is my .ascx file in which my logic reside
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="SearchBox.ascx.c
<link href="scripts/jquery.autoc
<script src="scripts/jquery-1.4.1.
<script src="scripts/jquery.autoco
<script type="text/javascript">
$(document).ready(function
$("#<%=txtSearch.ClientID%
});
</script>
<style type="text/css">
.abcd
{
width: 130px;
}
</style>
<div class="abcd">
<asp:TextBox ID="txtSearch" runat="server" AutoCompleteType="Disabled
</div>
please help on the same,Thanks
try registring ur User Control in web.config like
(under system.web-->pages-->Contr ols)
and now in ur aspx page html start typing
(under system.web-->pages-->Contr
and now in ur aspx page html start typing
ASKER
Thanks ABHINAY ,
Your solution work great when i drag my searchbox control to any other in any other directory page
but it does not work when i drag my searchbox.ascx file to states.ascx file.
I get compilation error like below :
Error 4 The page '/UserControl/States.ascx' cannot use the user control '/UserControl/SearchBox.as cx', because it is registered in web.config and lives in the same directory as the page.
Sorry if i missunderstood something..
Please Help !!
Your solution work great when i drag my searchbox control to any other in any other directory page
but it does not work when i drag my searchbox.ascx file to states.ascx file.
I get compilation error like below :
Error 4 The page '/UserControl/States.ascx'
Sorry if i missunderstood something..
Please Help !!
ASKER
Ignore my previous comment i solved that by changing the path in my web config
I am not getting any error but i dont get my result
what i am doing wrong ??
I am not getting any error but i dont get my result
what i am doing wrong ??
Can u put few screenshots of visual studio solution explored n ur errors?
ASKER
As you can see in the screen shot that
on TestUserControl.aspx file i am dragging my SearchBox.ascx file which is registered in web.config file as
and the error i get is :
Error 1 The page '/AdBooking/UserControl/Te stUserCont rol.aspx' cannot use the user control '/AdBooking/UserControl/Se archBox.as cx', because it is registered in web.config and lives in the same directory as the page
in my TestUserControl.aspx page when i drag the usercontrol then the line generetes is
please help ...
Thanks
SearchBoxScreenshot.bmp
on TestUserControl.aspx file i am dragging my SearchBox.ascx file which is registered in web.config file as
and the error i get is :
Error 1 The page '/AdBooking/UserControl/Te
in my TestUserControl.aspx page when i drag the usercontrol then the line generetes is
please help ...
Thanks
SearchBoxScreenshot.bmp
ASKER
IS there any way to provide full path to .ashx file
my current code is like below
<script type="text/javascript">
$(document).ready(function () {
$("#<%=txtSearch.ClientID% >").autoco mplete('Se arch_CS.as hx');
});
</script>
and i am asking that can we write the above code like the below one
<script type="text/javascript">
$(document).ready(function () {
$("#<%=txtSearch.ClientID% >").autoco mplete('~/ UserContro l/Search_C S.ashx');
});
</script>
my current code is like below
<script type="text/javascript">
$(document).ready(function
$("#<%=txtSearch.ClientID%
});
</script>
and i am asking that can we write the above code like the below one
<script type="text/javascript">
$(document).ready(function
$("#<%=txtSearch.ClientID%
});
</script>
if u r using it in the same directory, then register it in the page with a different tag prefix and use it.
Like in ur testusercontrol.aspx, register it as
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc2" %>
(Note: different tag prefix should be different from that of web.config)
and use it
---------
regarding the path,
use this: .autocomplete('/UserContro l/Search_C S.ashx');
Like in ur testusercontrol.aspx, register it as
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc2" %>
(Note: different tag prefix should be different from that of web.config)
and use it
---------
regarding the path,
use this: .autocomplete('/UserContro
** corrections **
if u r using it in the same directory, then register it in the page with a different tag prefix and use it.
Like in ur testusercontrol.aspx, register it as
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc2" %>
(Note: tag prefix should be different from that of web.config)
and use it
---------
regarding the path,
use this: .autocomplete('/UserContro l/Search_C S.ashx'); [starts from root]
or u can also try .autocomplete('../UserCont rol/Search _CS.ashx') ; [one folder up]
if u r using it in the same directory, then register it in the page with a different tag prefix and use it.
Like in ur testusercontrol.aspx, register it as
<%@ Register Src="SearchBox.ascx" TagName="SearchBox" TagPrefix="uc2" %>
(Note: tag prefix should be different from that of web.config)
and use it
---------
regarding the path,
use this: .autocomplete('/UserContro
or u can also try .autocomplete('../UserCont
ASKER
I TRIED ALL POSSIBLE PATH FOR .ASHX FILE BUT NO ONE WORKS
WHEN THE USER CONTROL AND ASPX PAGE BOTH ARE IN SAME FOLDER THEN ONLY IT WORKS ELSE NO
THANKS FOR YOUR REPLIES
WHEN THE USER CONTROL AND ASPX PAGE BOTH ARE IN SAME FOLDER THEN ONLY IT WORKS ELSE NO
THANKS FOR YOUR REPLIES
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I think my posts should be given consideration... .??
try giving its full path in ur page