|
Hi,
I have a gridview that generates dynamically inside an aspx page. There is a template field which is also generated dynamically inside the gridview. I need to display Image in this template field. The image data comes from a database as byte[]. I have created a CompositeControl that gets byte[] through a public property and renders this byte[] data as image using HttpContext.Current.Response.BinaryWrite() inside CreateChildControls() method. I am using this composite control in the above template field as a databound control to display image. But when I run the page, the page only displays the image and other page/gridview data is not showing at all. If I see the type of the generated page from the property its "JPEG Image". No "View Souce" is available.
Here I'm giving some extracts from the code:
product.aspx:
=============
TemplateField tc = new TemplateField();
tc.HeaderText = attribute.Name;
//tc.HeaderTemplate = new GridViewTemplateField(ListItemType.Header, attribute.Name);
tc.ItemTemplate = new GridViewTemplateField(ListItemType.Item, "AttribValueId");
tc.HeaderStyle.CssClass = "headerstyle";
tc.ItemStyle.CssClass = "rowstyle";gvProducts.Columns.Add(tc);
GridViewTemplateField.cs:
=========================
void ITemplate.InstantiateIn(System.Web.UI.Control container)
{
switch (templateType)
{
case ListItemType.Item:
ProductImageControl productImgCtl = new ProductImageControl();productImgCtl.DataBinding += new EventHandler(productImgCtrl_DataBinding);
container.Controls.Add(productImgCtl);
break;
}
void productImgCtrl_DataBinding(object sender, EventArgs e)
{
Control control = (Control)sender;
object dataItem = ((IDataItemContainer)control.NamingContainer).DataItem;
DataRowView productRow = (DataRowView)dataItem;
byte[] image = (byte[])productRow["ImageBytes"];
ProductImageControl pi = (ProductImageControl)sender;pi.IsThimbNail = true;
pi.ImgBytes = image;
}
ProductImageControl.cs
=======================
public class ProductImageControl : CompositeControl
{
protected override void CreateChildControls()
{
byte[] image = imgBytes; // through a property
HttpContext.Current.Response.ContentType = mimeType; // through a property
HttpContext.Current.Response.BinaryWrite(image);
}
}
Am I missing something or doing something wrong? Can anyone please give advise?
Thanks in advance!
|
|
|
|
|
Hi,
We have a website developed in asp.net 2.0, c#, sql server 2005. I need to provide users with a way to import their address books from gmail, yahoo, hotmail, and aol at the least.
I searched the net, and found soooo many solutions, most providing code to be integrated with our code, some providing web sites that would do the conversion. Ideally I'd like to connect to some sort of a service where we would provide the service the user's email and password, and would get back a comma separated list of address info from their address books. The solutions on the net cost anywhere from $0-$500, and I could not find any rating as to how well the solution would work. So its hard to go with any of them, and know that they'll work well now, and continue to work in the long term, as in they'll keep adding more facilities to import from, continue to support any changes needed to current solution such as when gmail changes their address book format...
Any recommendations will be appreciated.
Thanks.
Shefali
|
|
|
|
|
hi shefali_sinha,
According to me, only user can import a comma separated list of address info from address books. This can be happen on variety of domains such Yahoo, Gmail, Rediff, Aol and etc. These service providers doesn't allow any third party software to access address book of their users and generate a comma separated list from it.
Even if you know User Name And password then also Domain host doesn't provide access to any information of user using Software. You can access any user account using it's User id and password and generate a comma separated list from it but only manually.
There is no such (Tool)software which automatically feed user id and password and make login to domain name. These domain host keep track of such things and mark as a Spam.
So, it is better to generate a comma separated list of address info from address books after that you can use such list to your software. You can read list easily.
Also all these people on the internet talking about providing such facility is fake. If such things are possible then there is no security on the email and no secure HTTP's.
Hope this will help you.
Dilip Kumar Vishwakarma
|
|
|
|
|
Dilip,
Thanks for your response. Appreciate it.
Do you have any idea how LinkedIn and Facebook are importing their user's address books? They have done what I've proposed doing. They've been doing this for a while now (a year or so), and have not been marked as spam.
Thanks in advance.
Shefali
|
|
|
|
|
Hi..
I am also developing an application for same requirement i.e Importing Contacts from Mail Clients .I tried for many solutions but i didn't get any Valuable Solution for me.
we have downloaded some code from "ideabubbling" and tried it, but some times it is not working for some account's in rediff,Hotmail,AOL.in
will the maildomain's constantly change the session or links which are hardcoded in the downloaded code.If u found any solution please help me..its very Important for me.
--Can u provide any Suggestions or Solution for this Problem.
->I am little bit poor in Communication plz excuse if wrongly spell
Regards,
SukkuReddy
|
|
|
|
|
hello!
I need any article on the topic "Application/ Benifits or Advanteges of a Digital Dictionary".Please any one help me to search this topic at least five pages.
i'll b very thankfull.
my email id is: abdul_bu@yahoo.com
|
|
|
|
|
Don't cross post. Find one relevant forum and post there.
"I guess it's what separates the professionals from the drag and drop, girly wirly, namby pamby, wishy washy, can't code for crap types." - Pete O'Hanlon
|
|
|
|
|
Months ago in VS 2005 I did some demo projects with AJAX and everything worked.
I'm now using VS 2008 with the built in AJAX tools and I am running into some difficulty where the entire page is refreshing even though I have my event inside an update panel.
Here is my aspx page:
<br />
<form id="form1" runat="server"><br />
<div><br />
<br />
<asp:ScriptManager ID="ScriptManager1" runat="server"><br />
</asp:ScriptManager><br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
<br /><br />
<asp:UpdatePanel ID="UpdatePanel1" runat="server"><br />
<ContentTemplate><br />
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><br />
<br /><br />
<asp:Button ID="Button1" runat="server" Text="Button" /><br />
</ContentTemplate><br />
</asp:UpdatePanel><br />
<br />
</div><br />
</form><br />
Here is the page load code behind set to refresh the time in both labels.
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
Label1.Text = System.DateTime.Now.ToString();<br />
Label2.Text = System.DateTime.Now.ToString();<br />
}
The problem I am having is that even though the button click event occurs inside the update panel the entire web page is posting back. Both labels refresh with the current datetime.
Any ideas?
|
|
|
|
|
I've read threads regarding the xhtmlconformance, but my webhost says the machine.config has it set to Transitional already and I've even added the Transitional line to the project's web.config so I'm still baffled. The same code works locally on the machine, but not on the production site.
|
|
|
|
|
Just Remove the
<xhtmlconformance mode="Legacy"> tag from web.config file
I think It will Work For You
Ragards,
Sukku Reddy.
|
|
|
|
|
remove xhtml tag from web.config file
|
|
|
|
|
Hi,
I've got a a asp.net page that loads some embedded c# win controls. I use the <object> </object> tag to do it and it all works fine.
The problem is, when ever i rebuild my win controls dll and copy it over into my asp.net directory, the controls stop being loaded. To fix this, i need create a new project and copy everything over into this new project and it suddenly starts working again even though i have not changed ANY CODE.
Anyone seen this before?
Regards,
Gareth.
|
|
|
|
|
Hi,
I'm trying to work with nested repeaters. I have repeater 1(called repDetails), where I list errors (from table 1). To each error (row from table 1) there is a file list (from table 2). Each row with error has a unique errorCyklusId witch also is used in table 2 (so I can see which files belongs to which error)
I want my nested repeater (called repFiles) to show alle file names (from table 2).
I need to figure out, how I in ItemDataBound can find the first repeters errorcyklusId for each row and how I can call a control (in this case a hyperlink control) from ItemDataBound
My code:
<code><asp:Repeater ID="repDetails" runat="server" OnItemDataBound="repDetails_ItemDataBound">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
ID: <asp:Label ID="lblDetailsFiles" runat="server" Text='<%# Eval("errorCyklusId") %>'></asp:Label>
<asp:Repeater ID="repFiles" runat="server">
<ItemTemplate> <asp:HyperLink ID="lnkFile" runat="server" Text='<%# Eval("fileName") %>' Target="_blank" NavigateUrl=""></asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater></code>
<code>1 protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
2 {
3 //int errorCyklusId = Convert.ToInt32(e.CommandArgument);
4
5 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
6 {
7 try
8 {
9 ERSError error = new ERSError();
10
11 DataTable filelist = null;
12
13 if (error.GetFileList(1, ref filelist) == Status.Success)
14 {
15 int companyid = Convert.ToInt32(Session[ERSConnect.CookieCompanyId]);
16
17 RepeaterItem item = e.Item;
18 Repeater repFiles = item.FindControl("repFiles") as Repeater;
19 repFiles.DataSource = filelist.DefaultView;
20 repFiles.DataBind();
21 }
22 }
23 catch
24 { }
25 }
26 }
27 </code>
As you can see in line 3 I have comment out the e.CommandArgument (because when I try to run this, I get an error which sais, It dosn't know this.
I then hard coded a 1 (which is a errorCyklusID) in (line 13) (where I call my function (to call the database table) and it works .........but on each row I get the same file names out (because I each time call with the same errorCyklusId (in this case 1).
How do I get the row's errorCyklusID from repeater 1 and how do I get to
<asp:HyperLink ID=""lnkFile" runat="server" Text='<%# Eval("fileName") %>' Target="_blank" NavigateUrl="">so I can change the NavigateUrl from codebehind in the ItemDataBound?
Kind regards,
simsen
|
|
|
|
|
Use <pre/> tags to format your code. It's pretty much impossible to read your message.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
Thanks, I was not awear about I should that too...... I thought that code was that I should use........
Shall I know post my question again or how?
Kind regards,
simsen
|
|
|
|
|
<pre/> tags are better for code listings. For instance:
<asp:Repeater ID="repDetails" runat="server" OnItemDataBound="repDetails_ItemDataBound">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
ID: <asp:Label ID="lblDetailsFiles" runat="server" Text='<%# Eval("errorCyklusId") %>'></asp:Label>
<asp:Repeater ID="repFiles" runat="server">
<ItemTemplate> <asp:HyperLink ID="lnkFile" runat="server" Text='<%# Eval("fileName") %>' Target="_blank" NavigateUrl=""></asp:HyperLink>
</ItemTemplate>
</asp:Repeater>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:Repeater>
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Yes I understood you.
I hope you can help me with my problem instead.......
I cann't figure out, how I get the rows "signature", so I can call the database again for selecting to the nested repeater. And how I can change the NavigateURL for each row in the nested repeater?
My code:
<asp:repeater id="repDetails" runat="server" onitemdatabound="repDetails_ItemDataBound">
<headertemplate>
</headertemplate>
<itemtemplate>
ID: <asp:label id="lblDetailsFiles" runat="server" text=""><![CDATA[<%# Eval("errorCyklusId") %>]]>'></asp:label>
<asp:repeater id="repFiles" runat="server">
<itemtemplate>
<asp:hyperlink id="lnkFile" runat="server" text=""><![CDATA[<%# Eval("fileName") %>]]>' Target="_blank" NavigateUrl=""></asp:hyperlink>
</itemtemplate>
</asp:repeater>
</itemtemplate>
<footertemplate>
</footertemplate>
</asp:repeater>
1 protected void repDetails_ItemDataBound(object sender, RepeaterItemEventArgs e)
2 {
3
4
5 if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
6 {
7 try
8 {
9 ERSError error = new ERSError();
10
11 DataTable filelist = null;
12
13 if (error.GetFileList(1, ref filelist) == Status.Success)
14 {
15 int companyid = Convert.ToInt32(Session[ERSConnect.CookieCompanyId]);
16
17 RepeaterItem item = e.Item;
18 Repeater repFiles = item.FindControl("repFiles") as Repeater;
19 repFiles.DataSource = filelist.DefaultView;
20 repFiles.DataBind();
21 }
22 }
23 catch
24 { }
25 }
26 }
Kind regards,
simsen
Kind regards,
simsen
|
|
|
|
|
I mean if I wanted to add a new user or manage my users, can I do that on the server that I deployed my webapplication on...if yes how??
|
|
|
|
|
The website administration tool requires Visual Studio 2005 (or later) to be installed. You can use the ASP.NET Configuration Tool in IIS to configure your application in a production environment.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi everyone.
I have used session and cookie for login users with ASP.NET 1.1
and wrote:
<br />
Dim c As New HttpCookie("username")<br />
c.Value = r("company")<br />
c.Expires = Now.AddMinutes(30)<br />
Response.Cookies.Add(c)<br />
Response.Redirect("Main.aspx")<br />
r is an objects of SqlDataReader class. however when the user login an go to the main page on there I'v used a linkbutton as a logout order. and the code there is:
<br />
Request.Cookies.Remove("username")<br />
Request.Cookies("username").Expires = Now<br />
Response.Redirect("Login.aspx")<br />
and on the load event of login page:
<br />
If Request.Cookies("username") Is Nothing = False Then<br />
Session("user") = Request.Cookies("username").Value.ToString<br />
Response.Redirect("Main.aspx")<br />
Else<br />
Session("user") = Nothing<br />
End If<br />
but it dosen't works! and
Request.Cookies("username") Is Nothing = True !!!
Do I wrote the correct code or not ?
if exists another way plz help.
thanks
|
|
|
|
|
masoodp666 wrote: but it dosen't works! and
Request.Cookies("username") Is Nothing = True !!!
This is correct, isn't it? When the user logs out, you delete the cookie and redirect to the Login page. When the Login page loads, you check for the presence of the cookie. If the cookie has been removed, any attempt to refer to the cookie will return a null reference.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
oh excuse me !!!
I said
<br />
If Request.Cookies("username") Is Nothing = False<br />
when I'v deleted the cookie, Request.Cookies("username") Is Nothing MUST BE True, not False! and execute go to Else command.
modified on Monday, February 11, 2008 5:40 AM
|
|
|
|
|
I got it finally !!!
replace:
<br />
Request.Cookies.Remove("username")<br />
Request.Cookies("username").Expires = Now<br />
Response.Redirect("Login.aspx")<br />
With this:
<br />
Response.Cookies("username").Expires = Now<br />
Response.Redirect("Login.aspx")<br />
|
|
|
|
|
how to get file from internet by using the webclient
Dim Client As New WebClient()
Client.DownloadFile("http://www.yahoo.com", "D:\abc\yahoo.html")
when i run this code i am getting out put yahoo.html page when i run this code local host
if i host in remote server i want to download the same page in D:\ or any other directory what i need to give the path.
i getting exception when i run the same code in server.
i am getting out put successfully , when i run local host , pleasee any one can give me solution for this, i want to download file in my local phisical directoy, when i host my dotnet application in remote system.
This is haneef.............................................................
|
|
|
|
|
Wow, you have you posted your message on every forum? Did you think this would increase the chances of your question being answered?
Wrong - double posting only serves to annoy people and results in your message being ignored. Read the foum guidelines and think before you post again.
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|