|
Hi,
In one of my test ASP.NET 1.1 app I am trying to implement caching in one of the page (Default.aspx). I have implemented following directive
<%@ OutputCache Duration="600" VaryByParam="None" %> in my Default.aspx page. This page contains 1 Text Box & 1 Button. I type some stuff (lets say Hello World) in the textbox & redirect user to Default2.aspx page by clicking on the button.
In my Default2.aspx page I have an button which redirects user to Default.aspx page. When I am being redirected to Default.aspx page, Hello World is not being shown in Textbox.
Kindly let me know that is there anything that I need to implement extra in <%@ OutputCache Duration="600" VaryByParam="None" %> directive or some logic needs to be written in Default.aspx.vb code behind file?
Thanks in advance.
Regards,
Vipul Mehta
Regards,
Vipul Mehta
Sr. Software Engineer
|
|
|
|
|
Vipul Mehta wrote: In my Default2.aspx page I have an button which redirects user to Default.aspx page. When I am being redirected to Default.aspx page, Hello World is not being shown in Textbox.
I don't find any issue with caching here. This looks like you are not familiar with caching concept. Say you have texbox and button on default.aspx. And user is typing something in textbox. Where you are storing that value ? Without storing that value you are redirecting to other page. If you come back to the original page, that value will be cleared since you are not loading it when page loads.
Caching is used to speed up the ASPX page performance. OutPutCaching caches the page output and updates the cache in the specified duration. To test caching you need to store the user entered value some where and load in page_load to textbox. You can see this value won't be updated immediately, it will be updated when ASP.NET updates page cache again.
|
|
|
|
|
Dear All,
I am making web application using Asp.net C#(Visual Studio2005).
I have checkboxlist(which is populated by all the master filed like category , subcategory ,customer , etc ). Now based on selection I generates web control label (to name the field) and dropdownlistbox (which is filled by code and its description).
My problem is all controls comes one after other. I would like label then dropdownlist in a single line. That custlabel and its dropdownlist comes in one line then next say categorylabel and its dropdownlistbox should align in next line and inbetween them one free line .
My code is
foreach (ListItem li in CheckBoxListmst.Items)
{
if (li.Selected == true)
{
//code added to fetch dropdownlist
setting = ConfigurationManager.ConnectionStrings["StyleSearchConnectionString"];
if (setting != null)
{
conn = new SqlConnection(setting.ConnectionString);
cmd = new SqlCommand("Search_display");
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@cateid", SqlDbType.VarChar);
cmd.Parameters["@cateid"].Value = li.Text.ToString();
conn.Open();
cmd.Connection = conn;
try
{
// added controls
Label label = new Label();
DropDownList dropdownlist = new DropDownList();
label.ID = "label" + li.Text;
dropdownlist.ID = "dropdownlist" + li.Text;
label.Text = li.Text;
rdr = cmd.ExecuteReader();
while (rdr.Read())
{
ListItem ld = new ListItem();
ld.Text = rdr["disp"].ToString();
ld.Value = rdr["mstid"].ToString();
dropdownlist.Items.Add(ld);
}
PlaceHolder1.Controls.Add(label);
PlaceHolder1.Controls.Add(dropdownlist);
Response.Write(" ");
//added controls end
}
catch (SqlException ex)
{
}
Please Guide me or atleast give some help full link.
thanks
imaran khan
|
|
|
|
|
I was wondering if there's an equivalent 'include'-type method for asp.net pages
(like php's include "incFolder/header.php" which includes the header on each page).
I have a master page, with a contentPlaceHolder (CPH). In the CPH, I load each page. However, there's a section of (html) code that I'd like to be able to include at certain places WITHIN the CPH (ie. the individual pages).
Can individual pages also reference some sort of cph's themselves? (this would be awesome).
Scenario:
- - - - - -
masterPage.master:
<br />
asp: contentplaceholder id=myCPH . . . . asp: contentplaceholder<br />
- - - - - - - - -
- - - - - - -
MyCPH:
<br />
Hello world this is my page<br />
<br />
HERE I want to include a generic block of code to be used in individual CPH's<br />
<br />
more myCPH stuff...blah blah blah...<br />
- - - - - - - - - - - - - - - - -
Any help much appreciated,
Gerry
aps.net newbie
|
|
|
|
|
If it is only to be used in certain pages, then you could encapsulate it in a web user control and include that control where required.
|
|
|
|
|
hi Paddy,
Thanks but its only a bit of html (the page's footer) which I'd like to be easily update-able by changing the code in only one place rather than on every page...
Is this what a web user control achieves?
many thanks,
gerry
|
|
|
|
|
Hi,
I have created html page in asp.net. There I am getting imagefile paths in textarea. I have to create runtime thumbnail images with checkboxes by using these paths.
Thanks
-- modified at 2:46 Monday 23rd July, 2007
|
|
|
|
|
i was trying a query.Like in the table there an attribute for date.i have to select all
those dates which lies for the particular month.example from the following dates
4/20/2007
1/31/2006
2/5/2006
2/24/2006
3/28/2006
i have to select the february month dates.so the dates for feb month should be following
1/31/2006
2/5/2006
2/24/2006
3/28/2006
1/31/2006 and 3/28/2006 , was included because it's next and previous respectively , does
not complete the month
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Hi Sonia Gupta,
i m not getting ur Q...
& please post the Query in which ur getting problem so that we can give u proper soln...
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
i have to select those dates which lies in february month.
I have done till here.In the array collection , i am storing these february month dates, then i am sorting it in ascending order.
Now i am finding that initial date is not 1st feb , but it is 8th feb.
now in this case i want to include
1/31/2006 so as to compensate the missing initial seven days.
i want to implement this problem.
Please help.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
Pls explain clearly what is your problem?
SSK.
|
|
|
|
|
Refer this one]
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
if you are saying that you want to select date of the month then use datepart funtion ie datepart (dd, filed from where date comes ).
hope this will solve your problem
imaran khan
|
|
|
|
|
sir , which class datepart function comes under?
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
its an sql fuction , you can use in query. you can test as
select datepart(dd,getdate())
hope this will clear your doubt.
imaran khan
|
|
|
|
|
if ur field in the table is of type date..
just do order by with that field
it will order by datewise...
by the way DATEPART function works like
DATEPART(month, GETDATE())
it will give u current month in numeric (7)
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
thanks , i am facing one more problem regarding the two dimensioal array.
to implement this i am using the following code.
Dim datearray(0, 1) As String
Dim counter As Integer = 0
While (objDR.Read)
datearray(counter, 0) = objDR.Item("wef").ToString
datearray(counter, 1) = objDR.Item("weeklyOff").ToString
counter += 1
ReDim Preserve datecounter(counter, 0)
ReDim Preserve datecounter(counter, 1)
End While
is there any problem in the code.
the problem i am facing is .. the array goes out of control.
Sonia Gupta
Soniagupta1@yahoo.co.in
Yahoo messengerId-soniagupta1
Love is Friendship and Friendship is Love....
|
|
|
|
|
<asp:gridview id="grd_details" runat="server" selectedrowstyle-backcolor="Blue" allowsorting="true" onsorting="grd_details_onsorting" autogeneratecolumns="false">
<columns>
<asp:boundfield datafield="au_id" headertext="authorid" sortexpression="au_id">
<asp:boundfield datafield="au_lname" headertext="first name" sortexpression="au_lname">
<asp:boundfield datafield="au_fname" headertext="lastname" sortexpression="au_fname">
<asp:buttonfield buttontype="Button" text="select">
<asp:templatefield>
<selectedrowstyle backcolor="Blue">
using System;
using System.Data;
using System.Configuration;
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 _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Integrated Security=SSPI;Initial Catalog=pubs;server=IBM-9D721EFE7F7");
SqlDataAdapter da=new SqlDataAdapter("select au_id,au_lname,au_fname from authors",con);
DataSet ds=new DataSet();
da.Fill(ds);
grd_details.DataSource=ds;
grd_details.DataBind();
}
protected void grd_details_onsorting(object sender, System.Web.UI.WebControls.GridView e)
{
grd_details.Sorting = e.SortExpression;
}
}
in this code how to insert the delegate for onsort command.can any body tell me
|
|
|
|
|
Have you tried MSDN ?
I assume this is not production code, but a basic test of something ?
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
Hi, I need to create a folder on the server and upload the file to that new folder. The foldername is given by the user.
The problem is that it creates the foler, but don't upload the file and gives an exception. Here is the code:
string username = Membership.GetUser().UserName.ToString();<br />
string path = @"E:\asem\Visual Studio 2005\WebSites\Project\Files\" + username;<br />
try <br />
{<br />
if (Directory.Exists(path)) <br />
{<br />
}<br />
else<br />
{ <br />
DirectoryInfo di = Directory.CreateDirectory(path);<br />
} <br />
String filePath = path + "\\" + pdfUpload.FileName;<br />
pdfUpload.SaveAs(MapPath(filePath));<br />
Label1.Text = "File uploaded successfully";<br />
<br />
catch (Exception x) <br />
{<br />
Label1.Text = x.Message;<br />
} <br />
It gives me this exception:
x = {"'E:\\asem\\Visual Studio 2005\\WebSites\\Project\\Files\\erbol123\\bank_statment.jpg' is not a valid virtual path."}
thanx!
|
|
|
|
|
try using "Request.PhysicalApplicationPath"
dont do
pdfUpload.SaveAs(MapPath(filePath))
directly give pdfUpload.SaveAs(Request.PhysicalApplicationPath + "\\" + pdfUpload.FileName);
try using this..
hope it will work....
even i was getting the same problem i did this, & is working fine now.....
Amit Metkar
3i-infotech, Mumbai.
|
|
|
|
|
thanx, but it seems that it doesn't create a folder, so it gives the next exception"
x = {"Could not find a part of the path ...."}
|
|
|
|
|
I've got you thanx!!!
I created the folder first and then used Request.PhysicalApplicationPath
Thank you
|
|
|
|
|
Hi!
Long time since I posted here...
I created a typed dataset using the wizard by adding a Dataset to the project.
I have a very variable menu(for a web page) structure that is stored in a database(SQL2K5X).
I need to be able to have the menu items stored as an xml file that the menu control will read from and I don't know how to do that. I tried several things but... I'm here
So how do I dynamically manage my menu from a database?
Thank you for your help, sincerely,:->
Antoine
|
|
|
|
|
I hosted one page and also bin directory,web.config and precompiledapp.config while deploying will get these files.i just add only two controls in that page one HTML Text box and one Asp Label Control but when i open that page i could see only the Html Text box, Label is not shown in that page.But when i check the source of this page i could see the Label and its Text.what is the problem is there anything should i host.
|
|
|
|