|
The problem is when a user control is rendered images are relative to the page it is hosted in. So with your scenario since the first webform is in the root I am assuming that is where the Image folder is as well, and that is why the admin page cant find it because I am betting there is no Image folder where it is. What I would recommend is move that background style setter in the user control into a css file and link the image relative to that. css files are handled differently and an image linked in it is relative to it not that page that is linking the css file.
|
|
|
|
|
thanks Ian ... it worked.
|
|
|
|
|
Hi all,
I am working on a ASP.NET project where i am displaying several images and their details, both coming from a database table. What i want is i am calling a javascript when some one moves the mouse cursor over the image, for that i have designed the javascript but the javascript depends on the id (stored as a coloumn in the same table) of the row containing the image on which the cursor is positioned. I have taken the id field in an hidden field and tried the following code
protected void DataList1_ItemCreated(object sender, DataListItemEventArgs e)
{
ListItemType elemType = e.Item.ItemType;
if ((elemType == ListItemType.Item) || (elemType == ListItemType.AlternatingItem))
{
CheckBox cBox = (CheckBox)e.Item.FindControl("chkSel");
Image pimg = (Image)e.Item.FindControl("Image2");
HiddenField hf_Pid = (HiddenField)e.Item.FindControl("hfPid");
pimg.Attributes.Add("onmouseover", "showButton('"+hf_Pid.Value+"');");
cBox.CheckedChanged += new EventHandler(OnChangeHandler);
}
}
The idea is to find the value in the hidden field that is coming from the database and then pass it to the showButton() function in the javascript. But this doesn't seemed to work. Please help me in accomplishing this task. Your help will be highly appreciated. Thanks in advance
Regards
Sujay
|
|
|
|
|
hello all,
well please help in solving this issue......... plzzzzz. its really urgent..... Waiting for a reply
Regards
Sujay
|
|
|
|
|
hhmmm.
I have done the same thing and found an issue with making it work. I cannot update dynamically via javascript, any asp.net control on a page that was not created by code behind. If the control is cast on the aspx page, I cannot touch it by referencing the name dynamically in javascript (odd, but repeatable behaviour). If I create the control via code behind instead, the exact same routine in javascript will work. Note, the method that does not work, will not throw errors either. It just ignores your code (so it seems).
Try creating the checkbox in the onload routine instead and see if it works that way (give the table or container the checkbox exists in an ID so you can add the checkbox with code behind instead). You are on the right track, absolutely. I think its the weird behaviour that is hanging you.
|
|
|
|
|
Which thing is not working properly?
Tell whether the onmouseover event is not working.
Or The onmouseover is working but the id in the hidden field is empty. if so, then you can get the value of the hidden field in ItemDataBound event only.
|
|
|
|
|
I realize in reviewing this that there are several more caveats to it that cause this issue. I think I will cut bait here and run. Sorry.
|
|
|
|
|
Thank you Ramesh,
Actually the problem is that the hidden field value that i am trying to pass to the javascript is always showing null, but the hidden field is having the value when viewed from the source of the page from browser.
I wonder if the ItemDataBound event will allow me to add the javascript to the imgage tag.
Regards
Sujay
|
|
|
|
|
Have problem with getting check box in database checked when a current part of admin is approved or not approved here some code.
getting error with bool value
protected void ApproveAdvertiser()
{
//Add Code to add/edit/delete events (Possible case statement goes here?)
DataService ds = new DataService(int.Parse(ConfigurationManager.AppSettings["ConnStr"]));
Advertiser adv = new Advertiser();
adv.AdvertiserId = 0;
ind_approved.Checked = adv.Approver;
ds.approveAdvertiser(adv, ValuePassedIn);
Response.Redirect("Advertisers.aspx");
}
protected void BDelete_Click(object sender, EventArgs e)
{
if (RBLFunctions.SelectedValue.Equals("Delete"))
{
DeleteAdvertiser();
Response.Redirect("Advertisers.aspx");
}
else
{
if (RBLDelete.SelectedValue.Equals("Yes"))
{
//ApproveAdvertiser(true);
}
else
{
//ApproveAdvertiser(false);
}
Response.Redirect("Advertisers.aspx");
}
}
|
|
|
|
|
I don't see any meaningful code here. What is the exact error, and what line throws it ?
What are the methods you're calling ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Franklinlloyd wrote: if (RBLDelete.SelectedValue.Equals("Yes"))
{
//ApproveAdvertiser(true);
}
else
{
//ApproveAdvertiser(false);
}
I agree with Christian here, not enough meaningful code to help. Show us the code that you use to actually write the value to the db.
The typical mistake however here is that you are trying to write a true/false back to the database when the database requires a 1/0 value instead (real Boolean not that fake true/false stuff ).
|
|
|
|
|
protected void Submit_Advt_Click(object sender, EventArgs e)
{
// Add Code to add/edit/delete Advertisers (Possible case statement goes here?)
switch (RBLFunctions.SelectedValue)
{
case "Edit":
EditAdvertiser();
break;
case "Delete":
DeleteAdvertiser();
break;
case "Approve":
ApproveAdvertiser();
break;
}
}
protected void EditAdvertiser()
{
// Add Code to add/edit/delete events (Possible case statement goes here?)
DataService ds = new DataService(int.Parse(ConfigurationManager.AppSettings["ConnStr"]));
int selectedEvent = int.Parse(DDLSelections.SelectedValue);
// This is LINQ to Objects, so you get to learn a little LINQ too
Advertiser Pro = (from pr in CurrentAdvertser
where pr.AdvertiserId == selectedEvent
select pr).First();
// use the evnt object to load the textboxes like this:
Pro.Name= txtadvt_nm.Text;
Pro.Company = Txtcompany_nm.Text;
Pro.Email = txtcontactemail.Text;
Pro.Phone = nbr_contactphone.Text;
Pro.OriginalComments = txtcomment.Text;
Pro.IsApproved = ind_approved.Checked;
Pro.ImagePath = txtimagepath.Text;
Pro.DateFormFilled = DateTime.Parse(dt_Date.Text);
ds.updateAdvertiser(Pro);
Response.Redirect("Advertisers.aspx");
}
protected void DeleteAdvertiser()
{
// Add Code to add/edit/delete events (Possible case statement goes here?)
DataService ds = new DataService(int.Parse(ConfigurationManager.AppSettings["ConnStr"]));
int selectedEvent = int.Parse(DDLSelections.SelectedValue);
ds.removeAdvertiser(selectedEvent);
Response.Redirect("Advertisers.aspx");
}
protected void ApproveAdvertiser()
{
//Add Code to add/edit/delete events (Possible case statement goes here?)
DataService ds = new DataService(int.Parse(ConfigurationManager.AppSettings["ConnStr"]));
Advertiser adv = new Advertiser();
adv.AdvertiserId = 0;
adv.Approver = ind_approved.Checked;
ds.approveAdvertiser(adv, ValuePassedIn);
Response.Redirect("Advertisers.aspx");
}
protected void BDelete_Click(object sender, EventArgs e)
{
if (RBLFunctions.SelectedValue.Equals("Delete"))
{
DeleteAdvertiser();
Response.Redirect("Advertisers.aspx");
}
else
{
if (RBLDelete.SelectedValue.Equals("Yes"))
{
//ApproveAdvertiser(true);
}
else
{
//ApproveAdvertiser(false);
}
Response.Redirect("Advertisers.aspx");
}
}
protected void RBLDelete_SelectedIndexChanged(object sender, EventArgs e)
{
if (RBLDelete.SelectedValue.Equals("Yes"))
{
BDelete.Enabled = true;
}
else
{
if (RBLFunctions.SelectedValue.Equals("Approve"))
{
BDelete.Enabled = true;
}
else
{
Response.Redirect("Advertisers.aspx");
}
}
}
}
|
|
|
|
|
I have some client side vbscript and I need to pass it some data from the server side code behind file. On the server side it is a text session variable. How do I pass that value to the client side vbscript?
|
|
|
|
|
Write your session variable to the script
You can use something like this in your script <%= Session("SessionVar") %>
Example:
<script type="text/javascript">
alert('<%= Session.SessionID %>')
</script>
Alexei Rodriguez
|
|
|
|
|
|
I can use a session variable in my vbscript but I get an error when I add the following line in the html to reference the code behind file.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>
The error is:
The Session does not exists in the current context.
I want to use the code behind file, so how can I get this error to go away?
|
|
|
|
|
Good Evening All
I have a web Application that is compiling well with no Errors, i have Compiled each separately and worked well excluding the setup Project. i have to be honest, i once use the clean before i rebuilded the Solution and i came across this challenge. here is the Error on VS2005
http://www.vuyiswamaseko.tiyaneprope...ot_Compile.JPG[^]
And here is How my Project looks on the Solution Explorer
http://www.vuyiswamaseko.tiyaneprope...t_Explorer.JPG[^]
Thank you
Vuyiswa Maseko,
Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
Hi
please please please help!
i'm writing a asp.net app that imports data from an excel spreadsheet into a sql database, i slect a excel file and iterate through each row extracting the data, it works fine from my code and on the server but when i try doing the import from any other machine i get the following error:
System.Runtime.InteropServices.COMException: Exception from HRESULT: 0x800A03EC
my code is as follows
if (filMyFile.PostedFile != null)
{
HttpPostedFile myFile = filMyFile.PostedFile;
int nFileLen = myFile.ContentLength;
if (nFileLen > 0)
{
byte[] myData = new byte[nFileLen];
string strff = Path.GetFileName(myFile.FileName);
ApplicationClass app = new ApplicationClass();
Workbook workBook = app.Workbooks.Open(strff,
0,
true,
5,
"",
"",
true,
XlPlatform.xlWindows,
"\t",
false,
false,
0,
true,
1,
0);
Worksheet workSheet = (Worksheet)workBook.ActiveSheet;
int index = 0;
object rowIndex = 2;
object colIndex1 = 1;
object colIndex2 = 2;
object colIndex3 = 3;
object colIndex4 = 4;
object colIndex5 = 5;
object colIndex6 = 6;
object colIndex7 = 7;
object colIndex8 = 8;
object colIndex9 = 9;
try
{
while (((Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString()!= string.Empty)
{
string OrderNumber = ((Range)workSheet.Cells[rowIndex, colIndex1]).Value2.ToString();
string FullName = ((Range)workSheet.Cells[rowIndex, colIndex2]).Value2.ToString();
string[] arrayFullName = FullName.Split(' ');
string FirstName = arrayFullName[0].ToString();
string Surname = arrayFullName[1].ToString();
string CustomerID = ((Range)workSheet.Cells[rowIndex, colIndex3]).Value2.ToString();
string VoucherNumber = ((Range)workSheet.Cells[rowIndex, colIndex4]).Value2.ToString();
string Address = ((Range)workSheet.Cells[rowIndex, colIndex5]).Value2.ToString();
string CustomerCellNumber = ((Range)workSheet.Cells[rowIndex, colIndex6]).Value2.ToString();
string CustomerTellNumber = ((Range)workSheet.Cells[rowIndex, colIndex7]).Value2.ToString();
string ConsignmentNumber = ((Range)workSheet.Cells[rowIndex, colIndex8]).Value2.ToString();
string HardwareDesc = ((Range)workSheet.Cells[rowIndex, colIndex9]).Value2.ToString();
thank you in advance..
|
|
|
|
|
DotNetCoderJunior wrote: it works fine from my code and on the server
Could you explain what you mean by this, I'm taking it as it works fine through debugging against your local environment and against a server environment whilst running a browser on that server, but not when browsing from another computer against the server?
10110011001111101010101000001000001101001010001010100000100000101000001000111100010110001011001011
|
|
|
|
|
thank you for your response,Yes that i sexactly what the problem is.
|
|
|
|
|
To solve this problem do this works:
1. Create directory “C:\Windows\SysWOW64\config\systemprofile\Desktop ” (for 64 bit Windows) or “C:\Windows\System32\config\systemprofile\Desktop ” (for 32 bit Windows)
2. Set Full control permissions for directory Desktop (for example in Win7 & IIS 7 & DefaultAppPool set permissions for user
“IIS AppPool\DefaultAppPool”)
آنقدر در زندگی شکست خورده ام تا عاقبت راه شکست دادن زندگی را فراگرفتم
|
|
|
|
|
This error might be occured in different scenarios
(1) if you try to access the Excel cells which is not existis like Cells[-1,0].
(2) When you try to insert an Excel Worksheet before a worksheet and after another worksheet using the Sheets.Add() method
(3) When you write the content of a two dimentional array having some special chanracters like '=''%' in the array elements into some range of cells.
Check whether the above scenarios occured in the server side.
Also instead of using Microsoft.Office.Interop.Excel.ApplicationClass in your automation code, try to use
Microsoft.Office.Interop.Excel.Application class to create the Excel application instance.
Hope this will help you.
|
|
|
|
|
Thanx dude changing my code to Microsoft.Office.Interop.Excel.Application worked 
|
|
|
|
|
I am facing the same error!
this is my code:
Dim appExcel As Excel.Application
Dim wbBook As Excel.Workbook
Dim wsSheet As Excel.Worksheet
Dim strSheetName As String
On Error GoTo 0
Set appExcel = New Excel.Application
Set appExcel = CreateObject("Excel.Application")
Set wbBook = appExcel.Workbooks.Open(txtFile.Text, False, True)
If (wbBook Is Nothing) Then
Debug.Print "Invalid workbook"
End If
|
|
|
|
|
Hi All
I have created a web application where I load controls on different callbacks. So When User click on a button "Security" I have to load a security control using ajax which works fine. The problem I am facing is the following.
in Security Control I have one javascript function say ShowDetail(){ some js code here } which is required to be called when this control is loaded. When the control loads it does nto trigger , for testing I placed a button on contrl and on click I call ShowDetail() and it says that undefined function.
on another control I have Javascript with a variable say var id = '<%=this.ClientID%>'
so when I try to access "id" variable after loading that control Javascript rasie error with id is undefined.
Can any one help me out with these issues ?
Best Regards
Rizwan Bashir
Rizwan Bashir
<a href="http://www.alm-soft.com/">ALM Soft</a>[<a href="http://www.alm-soft.com/" target="_blank" title="New Window">^</a>]
|
|
|
|