|
How on earth is this a C# or ASP.NET question ?
Christian Graus
Driven to the arms of OSX by Vista.
"Iam doing the browsing center project in vb.net using c# coding" - this is why I don't answer questions much anymore. Oh, and Microsoft doesn't want me to.
|
|
|
|
|
I know this is VC++ .Net question, but there is no Message board for Visual C++ .Net.
Where can i post this question?
|
|
|
|
|
|
Hi,
Where i can get the best web parts example applications to learn about web parts.
Plz can any one suggest me.
Thank u
Lakshmi
|
|
|
|
|
|
Hi,
I am having some problem with the layout of the ASP page. Here is what happens.
I have 2 data grid inside a page which makes the page to be longer and therefore automatically a scrollbar will appear on the side of the browser for user to scroll down.
But what I set in the code is, only one datagrid will show at one time base on some criteria. So on the user side, it is appears not longer than the window size and therefore should not have any scroll bar at the side of the window.
The problem is, the 2nd datagrid is visible=false but the browser still detect the 2nd datagrid which tells the browser the web page is much longer than the window and therefore the scrollbar appear on the side.
What I want to know is, is there any way to tell the browser not to take into account those invincible components like the 2nd datagrid and so do not give a scrollbar at the side of the window?
Thanks in advance.
|
|
|
|
|
Hello,
I have a gridview which have an image in the header.
When I export this image into Excel, it shows the header image in Excel document without any problem. But when I transfer the exported excel file to some other system, the header image disappears. I think, this is because the image in excel document reference to the path in my system where it physically exists, i.e. Images folder under my website folder. When I transfer the file on other system, it tries to find the image at the same path, resulting a red cross icon at the place of image.
Is there any way I can insert image in excel so that it does not reference the path from where the image was originally inserted....?
Following is the code I am using to export grid view to excel...
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=FileName.xls");
Response.Charset = "";
Response.ContentType = "application/vnd.xls";
StringWriter StringWriter = new System.IO.StringWriter();
HtmlTextWriter HtmlTextWriter = new HtmlTextWriter(StringWriter);
gvToExport.RenderControl(HtmlTextWriter);
Response.Write(StringWriter.ToString());
Response.End();
|
|
|
|
|
No Problem in this code. May be your Image path is unknown in other system. you can try ~/images/imagename.jpg
|
|
|
|
|
Hello,
Thanks for the reply.
As I wrote in the query, the exported excel file looks for the path from where it was inserted. And when it is downloaded by client, excel fails to find referenced path for the image.
I was thinking about, somehow embed the image itself in the excel so that it refer the image internally.
|
|
|
|
|
I solved the issue by using a template excel document.
|
|
|
|
|
Hi all,
i have used sessions for my login page and now i want to implement remember me on this computer functionality can any body guide me how i able to do that.
when user comes next time username and Password will be saved ? how to achieve this ?
any suggestion .
best Regards
Rameez
|
|
|
|
|
I don't really now ASP.NET, but what about just using a cookie, maybe containing the session id and keeping it when the browser is closed?
|
|
|
|
|
|
Thanks for reply ,
Actually i have used sessions for login and now i have to implement Remember me Options kindly provide me example related to use of sessions and cookies or any article pointer to this issue .
best regards
Rameez
|
|
|
|
|
This article shows you how to implement the above functionality in ASP.NET.
Step 1: Add a checkbox in the login page
You can add a checkbox in the login page by dragging and dropping a checkbox from the toolbox when you are in page design mode, or you can create a checkbox programmatically in the code behind class.
The following code shows you how to do this in the second way:
private CheckBox _rememberMeCheckBox;
//.....
this._rememberMeCheckBox = new CheckBox();
this._rememberMeCheckBox.Text = "Remember me next time");
this._rememberMeCheckBox.Checked = true;
this.Controls.Add(this._rememberMeCheckBox);
//.....
Setp 2: Creat a cookie when a subscriber login
create a cookie in the Cliked event handler of the login button:
private void _LoginButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
//....
//....
ApplicationUser user = ApplicationUser.RetrieveCurrentUserByLoginId(userId);
if (user != null && user.Password == password)
{
Session["user"] = user;
Response.Cookies.Remove("CookieFromXXX");
if (this._rememberMeCheckBox != null &&
this._rememberMeCheckBox.Checked)
{
HttpCookie cookie = new HttpCookie(string.Format("cookie_from_{0}", this._host));
cookie.Values.Add("userId", user.Id);
cookie.Values.Add("pwd", user.Password);
cookie.Expires = DateTime.Now.AddYears(1);
Response.Cookies.Add(cookie);
}
}
//....
//....
}
Step 3: Override the OnInit method in the base page
If there is a base page which is the parent page of all other pages in your website, you can override the the OnInit method in the base page like the following code:
override protected void OnInit(EventArgs e)
{
//....
//....
if (!IsPostBack && Session["user"] == null)
{
if (Request.Cookies["CookieFromXXX"] != null)
{
HttpCookie cookie = Request.Cookies["CookieFromXXX"];
string userId = cookie.Values["userId"].ToString();
string pwd = cookie.Values["pwd"].ToString();
ApplicationUser user = ApplicationUser.RetrieveCurrentUserByLoginId(userId);
if (user != null user.Password == pwd)
{
Session["user"] = user;
}
}
}
base.OnInit(e);
}
Or you can add the above logic in the OnLoad method in the home page.
Step 4: Use the Session["user"] to determine the subscriber logged in or not
In any web page, you can check the Session["user"] to determine the subscriber logged in or not, see the following code:
if (Session["user"] != null)
{
//logged in already
//....
}
else
{
//haven't logged in yet
//....
}
Step 5: Expire the cookie when subscriber logout the website
Add the following code to expire the cookie when subscribers logout the website.
this.Session.Clear();
if (Response.Cookies["CookieFromXXX{0}"] != null)
{
//Response.Cookies.Remove("CookieFromXXX");
Response.Cookies["CookieFromXXX"].Expires = DateTime.Now.AddDays(-1);
}
Response.Redirect("./homepage.aspx");
|
|
|
|
|
Hey, sumit nice summary....
cheers,
Abhijit
|
|
|
|
|
|
"Remember me" is implemented by using cookie. When user chooses "Remember me" option, you need to set a cookie with a value which can identify the user. You can set user's id or login id. But make sure the value is encrypted as cookies can be easily changed since it is stored in the client machine. When page loads, check for cookie existance. Read the cookie value and create session for that.
|
|
|
|
|
Of course it can't be impossible, since they've done it. Frown
Here's the problem:
I'm using the AjaxControlToolkit, implementing a tabcontainer with 6 tabs. Each tab corresponds to an .aspx page. I've put an UpdatePanel in each TabPanel surrounding a ContentPlaceHolder (each ContentPlaceHolder being unique, and the corresponding pages referencing their own respective ContentPlaceHolders).
I've gotten around the problem of keeping the selected tab active, but I still have to deal with the flicker and visible postback on each tab (I'm using Response.Redirect()).
I've tried putting the whole tabcontainer in an UpdatePanel, to no avail. I literally have not been to sleep since yesterday and have looked at 100's of tutorials and examples trying to get this to work correctly!
All I want is to be able to switch tabs just as in FF or IE7 without looking like I'm going to a whole new website.
Here's the markup for one of the TabPanels:
<pre>
<cc1:TabPanel ID="tabpanel1" runat="server" HeaderText="Home" Width="900px">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<table id="Table5" width="900px">
<tr>
<td id="Td13" valign="top">
<asp:TreeView ID="TreeView5" runat="server" DataSourceID="ApplicationSiteMap" ExpandDepth="2"
Width="288px">
</asp:TreeView>
</td>
<td id="Td14">
<div id="Div9">
<asp:SiteMapPath ID="SiteMapPath5" runat="server" SiteMapProvider="DefaultSiteMapProvider">
</asp:SiteMapPath>
</div>
<asp:ContentPlaceHolder ID="DefaultContent" runat="server">
</asp:ContentPlaceHolder>
</td>
<td id="Td15" valign="top">
<div id="Div10">
</div>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>
</cc1:TabPanel></pre>
Thanks in advance for any help you can provide!! And if it's something VERY obvious, please don't think you'll offend me by saying so; I'm dumbfounded.
My Music | My Pics | My Articles
BlackDice
|
|
|
|
|
hi,
I stored the values of a class into a httpcontext.current.session("Description"). How can I read this values back from the object.
Thanks.
That is how I assign the value:
HttpContext.Current.Session("Descriptions") = New List(Of Property_Descriptions)
I have defined the following statements to read it back but I am getting invalid cast execption error message
Dim DescList As New List(Of Property_Descriptions)
DescList = HttpContext.Current.Session("Descriptions") 'Error is here
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
DescList = DirectCast(HttpContext.Current.Session("Descriptions"), List(Of Property_Descriptions))
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thanks for answering. I tried it before but it didn't also work out too.
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
JUNEYT wrote: it didn't also work out too
I suppose that you are trying to say that it didn't work?
Do you get any error message?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi Guffa,
It didn't work. I am getting the following error message
Unable to cast object of type 'System.Collections.Generic.List`1[Property_Descriptions]' to type 'System.Collections.Generic.List`1[Rentgo.Property_Descriptions]
What a curious mind needs to discover knowledge is noting else than a pin-hole.
|
|
|
|
|
You have more than one class named Property_Descriptions. You have to specify exactly in the code which class it is that you mean.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|