|
The url in your previous post describes how to do it, which aspect of the code are you having a problem with?
|
|
|
|
|
hi all iam using a javascript file referenced inside a page. In this script iam referencing a JS function found inside the page. It is generating an error."The Controls collection cannot be modified because the control contains code blocks (i.e. )."
the code is as follows
External JS:
var ok =false
....some code
if (!answer)
{
ok=false;
CloseOnOk();
}
where CloseOnOk is a javascript function found on the page
function CloseOnOk()
{
if (ok==true)
GetRadWindow().Close();
else if (ok==false)
{
var txthidden=document.getElementById('<%=txtHidden.ClientID %>');
txthidden.value='1';
}
}
iam also referencing the external javascript from the page
<script language="javascript" type="text/javascript" src="../../Scripts/Confirmation.js"></script>
Any ideas??
|
|
|
|
|
Its not clear which piece of code is throwing the error but you can try commenting out the GetRadWindow().Close(); line to see if that is the problem.
Also try changing txthidden.value='1'; to txthidden.innerHTML='1'; .
|
|
|
|
|
The error appears on the ecternal JS line where iam calling CloseOnOk();
it is not calling this function.
|
|
|
|
|
i want to use session variable in global.asax
when using folowing code.
protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
if (Session["role"] != null)
{
//strRole = Session["role"].ToString();
}
}
it gives error.>> Session state is not available in this context.
Please solve my problem as soon as possible.
Thanking u
ajai
|
|
|
|
|
ajau wrote: Session state is not available in this context.
The error message is very clear enough. You can't use session in this event as it's not instantiated. Application_AuthenticateRequest is in the early stage of ASP.NET page life cycle. AcquireRequestState is the event where session will be created. So choose any event that fires after AcquireRequestState .
|
|
|
|
|
Hi!
I used Win XP Pro to develop an ASP.NET application. Everything is working fine in Win XP Pro. I published/deployed the same application into the Win Server 2003 Standard Edition. The website loads correctly, but I am not able to insert/update/delete data.
I have enabled Named Pipes and TCP/IP.
No errors are shown. The page just refreshes after I click the submit button without showing the new updates.
Hope someone can help me with this prob!
Thanks in advance.
|
|
|
|
|
guardianhm wrote: Urgent: Database not updated
I am sure you will get plenty of replies as the question is URGENT
|
|
|
|
|
I m writing code for updae the dyndns for my webcam
I m using this code to implement this task
<br />
<br />
Private Sub dyndnsupdate(ByVal ip As String)<br />
<br />
Try<br />
Dim data(1024) As Byte<br />
Dim response As String = ""<br />
Dim count As Integer<br />
Dim socket As New Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)<br />
<br />
Dim host As IPHostEntry = System.Net.Dns.Resolve("professionalbkn.dyndns.org")<br />
Socket.Connect(DirectCast((New IPEndPoint(host.AddressList(0), 80)), EndPoint))<br />
<br />
If Not Socket.Connected Then<br />
Throw New Exception("Can´t connect to dyndns service")<br />
End If<br />
Dim request As String = "GET /nic/update?" + "system=dyndns" + "&hostname=" + _<br />
Me.hostName + "&myip=" + "&wildcard=" + "ON" + _<br />
"&offline=NO " + "HTTP/1.1" & Chr(13) & "" & Chr(10) & "" + _<br />
"Host: members.dyndns.org" & Chr(13) & "" & Chr(10) & "" + _<br />
"Authorization: Basic " + Me.userID + _<br />
":" + Me.password + "" & Chr(13) & "" & Chr(10) & "" + _<br />
"User-Agent: .net dyndns client" & Chr(13) & "" & Chr(10) & "" & Chr(13) & "" & Chr(10) & ""<br />
<br />
count = Socket.Send(System.Text.UnicodeEncoding.ASCII.GetBytes(Request))<br />
<br />
count = Socket.Receive(Data)<br />
While Not count = 0<br />
Response += System.Text.ASCIIEncoding.ASCII.GetString(Data, 0, count)<br />
count = Socket.Receive(Data)<br />
End While<br />
<br />
Socket.Shutdown(SocketShutdown.Both)<br />
Socket.Close()<br />
<br />
Response = Response.Substring(Response.IndexOf("\r\n\r\n") + 4)<br />
But it gives error that :
HTTP/1.1 404 Not Found
Server: Unknown/0.0 UPnP/1.0 Web Server
Connection: close
404 Not Found
Hope some one can understand my problem & will help to solve this problem
Thanks with anticipation
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
Is anybody there who can give some idea,link,info anything?????
Any idea would be appreciated
The Great Pleasure In Doing That Things That Other People Say U Can't By Doing This U Can Shut Their Mouth
|
|
|
|
|
hi all.i have developed this application to send email via ASP.Net(C#.net).now if i embedd an image using CID,the image is visible in outlook,but not in GMAIL,or Yahoomail even if i click to show picture.this,i guess is because the path of the image i am providing is of my system.and other systems can not access this path?the image dat i am embedding is not on the internet but its only at my system.so that means i cant provide any URL too.i dont want to send this image as attachment.i need to embedd it only.and i want it to be visible on Gmail or Yahoomail too..how can i do it?following is the code that i have written:
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.IO;
using System.Net.Mail;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string fileName = FileUploadReciepent.PostedFile.FileName;
fileName = fileName.Substring(fileName.LastIndexOf('\\') + 1);
string filePath = Server.MapPath(".") + fileName;
FileUploadReciepent.PostedFile.SaveAs(filePath);
ExcelReader reader = new ExcelReader(filePath); //Create an Excel file Reader
reader.setCurrentWorksheet(1); //Set current worksheet as 1
Array al = reader.getRange("A1", "A3"); //Get A1 to A3 from worksheet 1
foreach (object cell in al) //Loop through all the cells
{
TxtTo.Text += cell + ",";
MailMessage message = new MailMessage();
message.From = new MailAddress(txtName.Text);
message.To.Add(TxtReceipent.Text);
message.Subject = txtsubject.Text;
message.IsBodyHtml = true;
message.Body = Literal1.Text;
LinkedResource image = new LinkedResource("C:\\My Documents\\My Pictures\\anything.jpg");
image.ContentId = "anything";
//add the LinkedResource to the appropriate view
//htmlView.LinkedResources.Add(image);
SmtpClient client = new SmtpClient("smtp.xxx.com");
client.Host = "xxx.xxx.xxx.xxx";
client.Send(message);
}
}
protected void BtnUpload_Click(object sender, EventArgs e)
{
TextReader a = new StreamReader(FileUploadContent.FileContent);
Literal1.Text = a.ReadToEnd();
}
}
FileUploadReciepent-file upload control that gets all the email ida from my excel sheet.
fileUploadContent-uploads the html content,with embedded image from my system.
I have searched all over the internet,but couldnt find any solution.hope u'll help me finding One!!!!!!
|
|
|
|
|
I don't think it is possible to embed images this way for web based email clients.
Your best option is to find a way of getting your images onto a public website and linking to them from there.
|
|
|
|
|
thanks for ur reply...please do tell if u come up with any idea any other time
|
|
|
|
|
Hi to everyone,
a stupid question:
I added an Ajax control to Visual web Developer, adding a reference to the .dll compiled file in the project..
Now I'd like to use it, but I can't declare it in the asp.net page...
I also would like to add it to the toolbox..How could I do this?
Thanks!
Bye
|
|
|
|
|
I'm don't use "Visual Web Developer" but try right-clicking on the toolbox and if there is an option called "Choose Items.." then you can browse to the dll of the control and this will add it to the toolbox.
|
|
|
|
|
hi all,
i have a question regarding the id of link button .
I am placing the link button in a gridview,
Can anyone suggest me the way to do this?
Thanks
Mukkanti
|
|
|
|
|
gridviews have rows, rows have cells and cells have your controls. do somethin like this and see what happens
LinkButton lnk =(LinkButton)gv1.Rows.Cells[Index].FindControl("LinkButtonID");
Rocky
Success is a ladder which you can't climb with your hands in your pockets.
|
|
|
|
|
I've got some DataList control on a page to display some images after Thumbnail Photo Browsers articles at codeproj. But how to add SelectedItemTemplate to the page so I can click the image in the control and get DataList1_SelectedIndexChanged event to handle?
That does not work at selecting items?
<asp:datalist id="DataList1" runat="server" height="49px">
onitemdatabound="DataList1_ItemDataBound"
onselectedindexchanged="DataList1_SelectedIndexChanged" RepeatColumns="5"
RepeatDirection="Horizontal" Width="52px">
<selecteditemstyle bordercolor="#CC3300" borderstyle="Double">
<itemtemplate>
<selecteditemtemplate>
<asp:button id="Button1" runat="server" commandname="select">
chesnokov
|
|
|
|
|
How to write data in multiple sheets in excel file using Asp.net.
modified on Friday, April 4, 2008 2:44 AM
|
|
|
|
|
Hi,
I have two dropdowns.
I want that the DDL2 gets populated based on the values in DDL1.
How can I achieve that.
This is the way I am populating DDL1
string cmd = "Select * from abc ";
SqlDataAdapter da = new SqlDataAdapter(cmd, connection);
DataSet ds = new DataSet();
da.Fill(ds);
DropDownList1.DataSource = ds;
DropDownList1.DataTextField = "Name";
DropDownList1.DataValueField = "Code";
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, "--Select--");
|
|
|
|
|
Hi,
On selectedIndexChanged even of DDL1 pass the value of selection and retrieve the result based on passed value to bind the DDL2.
Regards
|
|
|
|
|
Hi,
I Created Link Button for Category Dynamically into the Datalist and Bind name to every Link Button. There are 7 Seven LinkButtons.
When I click First I want ID of that Click Link Button then From that ID I want to Fetch Records from the databse for Product and Display the Product.
Thanks
|
|
|
|
|
First bound data to your linkbutton in datalist .
then use this coding for ur click event for link button
if(e.commandName == "lnkbutton")
{
sqlconnection open();
string name = ((LinkButton)e.Item.Cells[0].Controls[0]).Text;
}
//pass name to query to fetch data
// mention your link button column no. in cells[] item.
Ashok
modified on Friday, April 4, 2008 8:06 AM
|
|
|
|
|
Hi all,
I have a calender shown below:
<asp:calendar id="Calendar1" runat="server">
ondayrender="Calendar1_DayRender" NextMonthText="" PrevMonthText="">
and code is shown below:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.LoadDim dt As DateTime
dt = Now
Calendar1.VisibleDate = dt
Calendar1.SelectedDate = dt
End Sub
Public Shared Function Week(ByVal tdDate As System.DateTime) As Integer
Dim myCI As New Globalization.CultureInfo("en-US")
Dim myCal As Globalization.Calendar = myCI.Calendar
Dim myCWR As Globalization.CalendarWeekRule = myCI.DateTimeFormat.CalendarWeekRule
Dim myFirstDOW As DayOfWeek = myCI.DateTimeFormat.FirstDayOfWeek
Return myCal.GetWeekOfYear(tdDate, myCWR, myFirstDOW)
End Function
Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DayRenderEventArgs) Handles Calendar1.DayRender
If Week(e.Day.Date) <> Week(Calendar1.SelectedDate) Then
e.Cell.Text = ""
End If
End Sub
when I run this, I am able get week in the calender and how can I make the calender to display weeks wise like months.
Please help me!
Thanks,
Mohd Farooq
|
|
|
|
|
I am using the following code
if (System.IO.Directory.Exists(Server .MapPath ("Albums/username" ))
{
System.IO.Directory.Delete(Server .MapPath ("Albums/username"),true);
}
to delete the folder named "username" and all of its subfolders. After this , if I take the folder Albums, I can see "username" folder. But when I double click on the folder, " Access is denied" message is coming. If I close visual Studio the folder itself is disappearing. In production server how will it work?
|
|
|
|