|
I am using this code to read images from a database and display in SlideShow availabe in the AJAX Tookit. I am not getting any error but I am not getting any image display though i have set the path and i have images there in the folder..
can u plz help..
THIS IS THE C# CODE:
using System;
using System.Configuration;
using System.Collections;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
public partial class _Default : System.Web.UI.Page
{
SqlConnection sql_connection = null;
SqlCommand sql_command = null;
// SqlDataAdapter sql_adapter = null;
SqlDataReader sql_reader = null;
// DataSet data_set = null;
[System.Web.Services.WebMethod]
[System.Web.Script.Services.ScriptMethod]
public ArrayList GetHomeSlides()
{
ArrayList slides_array = new ArrayList();
sql_connection = new SqlConnection("Data Source=.\\SQLEXPRESS;initial catalog=jassimrahma.com;integrated security=true");
sql_connection.Open();
sql_command = new SqlCommand("sp_get_home_slides", sql_connection);
sql_command.CommandType = CommandType.StoredProcedure;
try
{
sql_reader = sql_command.ExecuteReader();
while (sql_reader.Read())
{
slides_array.Add("http://localhost:49163/JassimRahma.com/gallery/" + sql_reader["photo_file"].ToString()); // Please make sure the format of imgurl is correct.
}
sql_reader.Close();
}
catch (Exception)
{
throw;
}
finally
{
sql_connection.Close();
}
return slides_array;
}
protected void Page_Load(object sender, EventArgs e)
{
GetHomeSlides();
}
}
THIS IS THE ASP.NET CODDE:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register TagPrefix="ucl" TagName="ucl_website_menu" Src="~/website_menu.ascx" %>
<%@ Register TagPrefix="ucl" TagName="ucl_website_header" Src="~/website_header.ascx" %>
<%@ Register TagPrefix="ucl" TagName="ucl_website_recent_images" Src="~/website_recent_images.ascx" %>
<%@ Register TagPrefix="ucl" TagName="ucl_website_latest_articles" Src="~/website_latest_articles.ascx" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html id="Html1" xmlns="http://www.w3.org/1999/xhtml" runat="server" dir="rtl" lang="ar-bh" >
<head id="Head1" runat="server" dir="rtl" lang="ar-bh">
<link href="website_stylesheet.css" rel="Stylesheet" type="text/css"/>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="keywords" content="البحرين, مملكة البحرين, المناسبات, زواج, تأبين, أخبار, خبر, احتفال, مهرجان, ندوة, المنامة, " />
<meta name="Description" content="جميع المناسبات والفعاليات في مملكة البحرين بين يديك" />
<meta http-equiv="expires" content="-1" />
<meta name="robots" content="INDEX,FOLLOW" />
<title>JassimRahma.com</title>
</head>
<body id="Body1" runat="server" dir="rtl" lang="ar-bh" style="margin: 2" >
<form id="form1" runat="server">
<div>
<ajaxToolkit:ToolkitScriptManager ID="ScriptManager1" runat="server" />
<asp:Table runat="server" HorizontalAlign="Center" Width="775" CssClass="" CellPadding="0" CellSpacing="0">
<asp:TableRow>
<asp:TableCell></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell>
<ucl:ucl_website_menu ID="Ucl_website_menu" runat="server" /><br /><ucl:ucl_website_header ID="Ucl_website_header" runat="server" />
<asp:Table runat="server" Width="778" CellPadding="0" CellSpacing="0" BorderColor="Transparent" BorderStyle="None" BorderWidth="0">
<asp:TableRow>
<asp:TableCell HorizontalAlign="Right" VerticalAlign="Middle" CssClass="titelcell"><strong>من ألبوم الصور :</strong></asp:TableCell>
<asp:TableCell HorizontalAlign="Right" VerticalAlign="Middle" CssClass="separatorcell"></asp:TableCell>
<asp:TableCell Width="200" HorizontalAlign="Right" VerticalAlign="Middle" CssClass="titelcell"><strong>مواقع مفيدة :</strong></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell ColumnSpan="3"><br /></asp:TableCell>
</asp:TableRow>
<asp:TableRow>
<asp:TableCell HorizontalAlign="Right" VerticalAlign="Top">
<asp:Image ID="Image1" Width="500" Height="500" runat="server" />
<ajaxToolkit:SlideShowExtender ID="SlideShowGallery" runat="server" PlayInterval="3000"
TargetControlID="Image1"
SlideShowServiceMethod="GetHomeSlides"
AutoPlay="true"
Loop="true" />
</asp:TableCell>
<asp:TableCell HorizontalAlign="Right" VerticalAlign="Top"></asp:TableCell>
<asp:TableCell Width="200" HorizontalAlign="Center" VerticalAlign="Top" CssClass="separatorcell" BorderColor="Black" BorderStyle="Solid" BorderWidth="1">
<asp:Image ID="Image2" ImageUrl="~/links/bahrain_egov.jpg" runat="server" /><br /><br />
<asp:Image ID="Image3" ImageUrl="~/links/on_10_net.jpg" runat="server" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
<br />
<ucl:ucl_website_latest_articles ID="ucl_website_latest_articles" runat="server" />
</asp:TableCell>
</asp:TableRow>
</asp:Table>
</div>
</form>
</body>
</html>
|
|
|
|
|
jrahma wrote: protected void Page_Load(object sender, EventArgs e)
{
GetHomeSlides();
}
So, you call GetHomeSlides, which builds and returns an ArrayList of URLs, but then you don't do anything with them. You effectively throw away the results. Perhaps you should assign the result of the method to something.
Oh... and this code:
jrahma wrote: catch (Exception)
{
throw;
}
Nice... What exactly does that do? (Yes, I know the answer, I want you to think about it)
|
|
|
|
|
I have two horizontal ads on my web page beside each other and i want to retrieve two ads to diplay there from my ads.xml using the AdRotator? is it possible to handle both the same time or it has to be handeled speratelly?
|
|
|
|
|
I have an GridView listing events and i want to hide the following events:
Evsnts where date > Today
Evants where date < Current Months
with an option to collapse or expand?
something just like this:
<a href="http://www.ahlanbahrain.com/temp/gridview.jpg">http:
how can i do that?
|
|
|
|
|
Hi,
Bind all your data to a DataList control. And keep an identification on a HiddenField to identify the row of the above condition is true.
<asp:DataList ID="DataList1" runat="server" OnItemDataBound="DataList1_ItemDataBound">
<ItemTemplate>
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Title") %>'></asp:Label>
<cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server" ExpandControlID="Label1"
CollapseControlID="Label1" TargetControlID="Panel1">
</cc1:CollapsiblePanelExtender>
<asp:Panel ID="Panel1" runat="server">
<asp:Label ID="Label2" runat="server" Text='<%#Eval("Description") %>'></asp:Label>
</asp:Panel>
</ItemTemplate>
</asp:DataList>
On DataList1_ItemDataBound use the FindControl method to locate the HiddenValue and set the required panel collapse and expand as for the requirement. Or with out binding the details you could bind it at the time of selection of the title and expand it.
Hope it helps
Thx,
Gayani
|
|
|
|
|
Hi all,
Im using VS 2003 for my small application, and there im using repeater control, there i need check each row in repeater control is there any web url is in data content, and if there any web url i need to set different color for that particular row, im bit stuck of that, pls help me to do this
Thank you.
|
|
|
|
|
You can iterate rows in the repeater control. Regular expression can be used to check whether the data has a URL. Check this[^] which has regular expression examples (not checked whether it has a regex for URL). Changing the color will be trivial.
|
|
|
|
|
I want to design a web for online shopping.I don't want to use login controls.I want to use session for users.when a user add an item to shopping cart how can i use session to save the items in shopping cart without saving in database?I don't want to use cache.I use a class for shoppingcart.when a user add item to it's shoppingcart I don't want to go to the page of the shoppingcart.
|
|
|
|
|
bbc_sh wrote: I want to use session for users.when a user add an item to shopping cart how can i use session to save the items in shopping cart without saving in database?I don't want to use cache
Okay, it says you don't have much idea about what session and cache is. BTW, keeping shopping cart items in session is not a good idea. I'd create a table something named "shopping" in the database and keep the items there which can be accessed using the session id.
Keeping items to session is trivial. Say you have a product class named "Product". Then you can keep a generic List<Product> instance in the session which represents shopping cart items. To add items,
List<Product> shoppingCart = Session["ShoppingCart"] as List<Product> ;
shoppingCart.Add(new Product());
bbc_sh wrote: I don't want to go to the page of the shoppingcart.
If you don't want to move to shopping cart page, just don't redirect after adding item.
|
|
|
|
|
If i want to use cache for shoppingcart what should i do?
|
|
|
|
|
I have a website using forms authentication. I seem to have a problem with it and I'd appreciate if you could help me on this. I use <forms timeout="600"> and <sessionState timeout="600"> in web.config. In login page I have this code:
protected void pageLogin_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Membership.ValidateUser(this.pageLogin.UserName.Trim(),this.pageLogin.Password.Trim()))
{
MembershipUser u = Membership.GetUser(this.pageLogin.UserName.Trim(), false);
Session["UserId"] = u.ProviderUserKey.ToString();
e.Authenticated = true;
}
else
{
e.Authenticated = false;
}
}
protected void pageLogin_LoggedIn(object sender, EventArgs e)
{
FormsAuthentication.RedirectFromLoginPage(Session["UserId"].ToString(), false);
}
I use Session["UserId"] on other protected pages. The problem is, sometimes when I refresh a page after a short while that uses Session["UserId"] I get null reference error on Session["UserId"] line. Why it is expiring so soon, I don't have anything modifying web.config or the website so I don't think IIS is recycling. And shouldn't it redirect to login page if session is expired? Am I missing something here?
This is on WinXp sp2 and IIS6.
|
|
|
|
|
what authentication mode did you set in IIS ? if you have used forms then you should select Anonumous authentication.
cheers,
Abhijit
|
|
|
|
|
currently i m using asp.net with c# (.net 2005, 2.0 framework) and SQL SERVER database.
Here i launched my project in server and data will be fetched and processed by users.
Here i want to protect records and it should not fetched by more than one person.
For example..
if the record "1" has been taken by a user, then it should be locked and no other user should fetch it (a message should be prompt).After the completion of work and if the user release it (finished processed and save/cancel) then it can be accessed by others..
how to implement it...
help me. thanks in advace - KARAN
|
|
|
|
|
|
thanks sam xavier. it help me a lot and this is what i need exactly to me.... but this is via QUERY. And is there any approach towards using in .net 2005? (C#.NET with asp.net)?
|
|
|
|
|
Hi,
I created a web application in ASP.NET 2.0 with just a label and a button. In the button click i've the code:
Label1.Text = Server.MapPath("/mapTest");
I deployed this app in a Windows 2000 Server SP4, and in my Win Xp Pro SP3. The app was deployed in D:\TestFolder\
The Label text in Win XP was:
D:\TestFolder\default.aspx
The Label text in Win 2000 SP4 Server was:
C:\Inetpub\wwwroot\TestFolder\default.aspx
Could anyone please explain why this happens?
Regards,
Blumen
|
|
|
|
|
Blumen wrote: The Label text in Win 2000 SP4 Server was:
C:\Inetpub\wwwroot\TestFolder\default.aspx
in Win 2000, did you deployed in D:\TestFolder or inetpup ?
cheers,
Abhijit
|
|
|
|
|
|
In Win 2000, Virtual Directy - > Right Click on your virtual Directory - > Propertires - > Check Local path in Virtual Directory TAB.
what is that ?
cheers,
Abhijit
|
|
|
|
|
|
In Windows XP pro the site has to be a virtual directory (as the IIS is limited to the default site), but in Windows 2000 server it could be a web site.
Have you deployed it as a site or a virtual directory on Windows 2000 server?
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Thank you for the reply.
Guffa wrote: In Windows XP pro the site has to be a virtual directory (as the IIS is limited to the default site), but in Windows 2000 server it could be a web site.
I din't understand the above part.
In Windows 2000, I've deployed it as a virtual directory. What would be the difference in deploying as a website?
|
|
|
|
|
when i execute the crystal report the report header section vanishes.at the design time the report header sections are covered by blue lines is there any option to enable or disable the concerned section.
how i can show report header in a crystal report
Thanks in advance
sourav ghosh
|
|
|
|
|
Example, you have report.rpt means.. open report.rpt then right click Insert->section->select report header from left side option then in right side un-check the Suppress (No Drill Down)->ok
Now you can see your report header section..
S.G. SIVA M.C.A.,
+919865943001
|
|
|
|
|
Hi all,
how i can display the multiple records of reserved vehicle in a single row
for suppose if one vehicle is reserved two times in a current date i have to display both records in a single row against vehicle name .
and in a second row i want to display records for second vehicle if it is reseerved iam usiing sql server 2000 as beckend database .
my fileds are Reserve_ID,Vehicle_Name,ReserveStarttime,ReserveEndtime ,purpose .
kindly help me in this regard iam stuck on this .
regards
Rammez
Thanks in advance
|
|
|
|