|
|
This is a weird thing I never seen. Hoping somebody got the solution.
So I have a asp .net page with an UpdatePanel. Inside that I have a dropdownlist and a button. In the On Page Load I populate the dropdownlist and have a value selected.
On the button click even I register a clientscript something like this ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "Alert", "alert(hello')", true);
Problem part:
When I click on the button, the alert goes on, then I cannot select anything on the dropdownlist.
And this seem to happen with Mozilla only. IE is behaving ok with this.
You get the best out of others when you give the best of yourself.
|
|
|
|
|
trilokharry wrote: the alert goes on, then I cannot select anything on the dropdownlist
What do mean by alert goes on? Is that alert is never removed?
What do mean by unable to select anything, what behaviour you are facing here? Page hanged? Unable to do anything?
Also, check view source in Firefox, if you find anything unusual.
|
|
|
|
|
Hi,
How to bind a asp.net menu control with a treeview.
eg: I have a treeview control with data, i need to bind a asp.net control with treeview data.
Thankyou
YPKI
|
|
|
|
|
|
hi,
currently i m using asp.net 2.0 (C#).
i want to export the data from database and place each value in specified excel cell.
for example...
A1 : UserName
B1 : UserID etc etc....
how to achieve it?
|
|
|
|
|
|
Hi,
how can i merge two colums in a HtmlTableRow using c# code.
|
|
|
|
|
Use ColSpan property of HtmlTableCell.
|
|
|
|
|
I have a page with several controls that are shown or hidden depending on some checkboxes being checked or unchecked by user. The problem is that I have to run some JavaScript function in window load event for each of those controls. When I place those calls in the ascx they aren't called. Also JavaScript functions defined in those controls aren't visible.
Example:
<br />
<%@ Control Language="C#" AutoEventWireup="true" Inherits="SomeControl" CodeBehind="SomeControl.ascx.cs" %><br />
<br />
<script type="text/javascript"><br />
<br />
function test() {<br />
alert('Testing call');<br />
}<br />
</script><br />
<br />
<asp:CheckBox runat="server" Text="Label" onclick="javascript:test();" /><br />
In the above code (when control is loaded to the page with UpdatePanel (on first page call it has Visible = false and on some event Visible is set to true)) clicking checkbox does nothing or in IE8 triggers error, that object was null.
The question: how to register function test in this scenario so it was visible to the browser?
|
|
|
|
|
If these controls are in update panel then on setting visibilty true from false only html gets renders not the javascript part.So better to the javascript function in a separet file and include that in page.Now register the startupscript from codebehibd of your control whch you want to be executed when your control loads.
|
|
|
|
|
Almost... But when I do Page.RegisterStartupScript("scriptName", "function() { runStartupForControl(%arguments%); }"); it's get rendered at the bottom of the page (it isn't placed between "script" tags).
|
|
|
|
|
OK, I had some errors in code... It works now. Thanks.
|
|
|
|
|
Your Welcome
|
|
|
|
|
I have a set of Sql statements which add a column to the DataBase table and also add a foreign key relationship.The statements execute fine on the sql server where as the same set of statements fail to be executed through the SQlCommand object invoke on a button click on a ASP.NET page.
Please help...below is my code
private void CreateReferenceKey(string parentTableName,string tableName,string refcolumn,string parentRefColumn)
{
StringBuilder refQuery = new StringBuilder();
refQuery.AppendLine(" if NOT EXISTS (select * from information_Schema.columns where table_name='"+tableName +"' and column_name = '"+refcolumn +"') ");
refQuery.AppendLine("BEGIN");
refQuery.AppendLine(" alter table [dbo].[" + tableName + "] add [" + refcolumn + "] smallint NULL ");
refQuery.AppendLine("ALTER TABLE [dbo].[" + tableName + "] WITH CHECK ADD CONSTRAINT [FK_" + parentTableName + "_" + tableName + "] FOREIGN KEY([" + refcolumn + "]) ");
refQuery.Append("REFERENCES [dbo].[" + parentTableName + "] (["+parentRefColumn +"])");
refQuery.AppendLine(" ALTER TABLE [dbo].[" + parentTableName + "] CHECK CONSTRAINT [FK_" + parentTableName + "_" + tableName + "]");
refQuery.AppendLine("END");
SqlCommand command = null;
SqlConnection connection = new SqlConnection(connString);
command = new SqlCommand(refQuery.ToString(), connection);
connection.Open();
command.ExecuteNonQuery();
connection.Close();
}
|
|
|
|
|
You can do the same by developing generalized SP.
Pass TableName, ColumnName and Type to add that particular
Column to the specified table.
And also do the same for adding constraint.
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
I have created fusion chart from xml in asp.net.
If i want to create child values in a fusion a chart.Suppose i want to show the students of respective class then i can use simple chart and in this chart if I want to show number of boys and girls for respective classes then how to achieve it ?
Thanks
|
|
|
|
|
Hi,
I am currently redirecting user to a different page, say ABC, using Javascript. Now if my page ABC doesnt exist, i dont want to show 404 page, but custom error page. The custom error page in web.config doesnt work here as page is being redirected from client site. See below me web.config code
<customerrors mode="On" defaultredirect="~/Error.aspx">
<error statuscode="404" redirect="~/PageNotFound.aspx">
On my Webform I have written the following code for redirection using javascript.
Javascript method
function redirectToStaticPage(language)
{
var newPageURL = "http://xyz.aspx";
try
{
window.location = newPageURL;
}
catch(err)
{
txt="There was an error on this page.\n\n";
txt+="Error description: " + err.description + "\n\n";
txt+="Click OK to continue.\n\n";
alert(txt);
}
}
Currently it takes me to http://xyz.aspx which doesnt exist. I want to show in this case custom error page.
Please help ASAP. Thanks
|
|
|
|
|
I think you need to do URL Validation at server side.
Once it is validated then you can redirect to that
particular URL.
Use following code to validate URL.
Public Class UrlValidity
Public Shared Function IsValid(ByVal Url As String) As Boolean
Dim sStream As Stream
Dim URLReq As HttpWebRequest
Dim URLRes As HttpWebResponse
Try
URLReq = WebRequest.Create(Url)
URLRes = URLReq.GetResponse()
sStream = URLRes.GetResponseStream()
Dim reader As String = New StreamReader(sStream).ReadToEnd()
Return True
Catch ex As Exception
‘Url not valid
Return False
End Try
End Function
End Class
HTH
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
hi ther,
i have a project created in asp.net 2.0. i want to calcuate how much time user spend on my site ???
i can do it by using (logout time - login time) ...but what happens if user directly close the browser by clicking [X] button...
what should i do ???
any idea...????
Thanks in advnace
koolprasad2003
Rating always..... WELCOME
Be a good listener...Because Opprtunity knoughts softly...N-Joy
|
|
|
|
|
You can handle this by using Session_Start and Session_End in Global.asax. Handle logout time at <code>Session_End</code> .This function will also be called if user close the browser by clicking [X] button, not at the same time but when it session expires.
|
|
|
|
|
|
Hi,
i need help in passing parameters from a datalist to another page.
this is how my app works:
i have a database ( access) a table with the following columns: id,title,desc,photo.
another table with the following columns: (startsin, endsin,price,tId)
on the first page (tourpack.aspx) i have a datalist, when user clicks on a button that is in the templateitem of the datalist, he will be transfered to another page called (showtour.aspx). what im trying to do is passing the ID parameter from the first page (table 1) to the second page (showtour.aspx) with the id number so he can see the specific details of that "tour" that are located In the second table.
any idea how it works? i would appreciate any kind of help.
Thanks,
Farraj.
|
|
|
|
|
Farraj wrote: passing the ID parameter from the first page (table 1) to the second page (showtour.aspx)
you need to have the a column(ID) same in both the tables. Join both the tables.
pass the ID through query string to showtour.aspx
//on page load of show tour
using the id from query string get the tour details
|
|
|
|
|
Thanks for your reply
Do you mean to join the both tables or the both ID columns? if so how do i do that?
and how can i the id from query string to get the tour details in the other page (which there i have a datagrid)?
Thanks for your help
|
|
|
|