|
Hi,
i am inheriting a masterpage in an aspx page. in the masterpage i am using updatepanel control.
now in the codebehind of that aspx page, when i complete the databasetransaction process, i want to display an alert box. But that alert box is not getting displayed as i am using updatepanel control.
prior to using updatepanelcontrol it was working as i use to display the alert box using httpcontext.current.response.write.
now as i am using updatepanelcontrol the alert box is not getting displayed by using registerscriptblock also.
Sandeep Kumbhar
|
|
|
|
|
i think this will help you[link]
|
|
|
|
|
Handle end request event of the update panel as following will may help you
1. Get instance of PageRequestManager
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
2. Callback function:
function endRequestHandler(sender, eventArgs)
{
if (eventArgs.get_error() != undefined && eventArgs.get_error().httpStatusCode == '500')
{
var error Message = eventArgs.get_error().message;
eventArgs.set_errorHandler(true);
alert(errorMessage);
} else
{
//alert($get("hidField").value);
}
}
|
|
|
|
|
Always use ScriptManager.RegisterStartupScript in case of Update panel rather than using ClientScript .
do like this :
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('hi');", true);
|
|
|
|
|
hi,
indeed this was a very good solution.
now i making this thing generic. so that i only have to call the msgpopup class and display the message. i am calling the dll of the project where i am writing the same code
ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('hi');", true);
but this seems to be not working. it fails to display the message box.
following is the code in the dll.
the code:--
==========
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Collections;
using System.Text;
using System.Web.UI;
/// <summary>
/// Summary description for MsgPopUp
/// </summary>
public class MsgPopUp
{
protected static Hashtable handlerPages = new Hashtable();
public static void Show(string Message)
{
try
{
if (!(handlerPages.Contains(HttpContext.Current.Handler)))
{
Page currentPage = (Page)HttpContext.Current.Handler;
if (!((currentPage == null)))
{
Queue messageQueue = new Queue();
messageQueue.Enqueue(Message);
handlerPages.Add(HttpContext.Current.Handler, messageQueue);
currentPage.Unload += new EventHandler(CurrentPageUnload);
}
}
else
{
Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));
queue.Enqueue(Message);
}
}
catch (Exception ex)
{
throw ex;
}
}
private static void CurrentPageUnload(object sender, EventArgs e)
{
try
{
Queue queue = ((Queue)(handlerPages[HttpContext.Current.Handler]));
if (queue != null)
{
StringBuilder builder = new StringBuilder();
int iMsgCount = queue.Count;
builder.Append("<script language='javascript'>");
string sMsg;
while ((iMsgCount > 0))
{
iMsgCount = iMsgCount - 1;
sMsg = System.Convert.ToString(queue.Dequeue());
sMsg = sMsg.Replace("\"", "'");
builder.Append("alert( \"" + sMsg + "\" );");
}
builder.Append("</script>");
handlerPages.Remove(HttpContext.Current.Handler);
//HttpContext.Current.Response.Write(builder.ToString());
Page currentPage = (Page)HttpContext.Current.Handler;
ScriptManager.RegisterClientScriptBlock(currentPage, currentPage.GetType(), Guid.NewGuid().ToString(), "alert('from baseengine')", true);
//if (!script.IsClientScriptBlockRegistered(script.GetType(), "Alert"))
//{
// script.RegisterClientScriptBlock(script.GetType(), "Alert", "alert('record inserted');", false);
//}
}
}
catch (Exception ex)
{
throw ex;
}
}
}
}
Sandeep Kumbhar
modified on Wednesday, December 30, 2009 7:12 AM
|
|
|
|
|
Trying to build a SOAP web service using complex types and hit a road block. I am using VS to create a web reference to the SOAP service. ASP.NET 2.0, C#.
Getting the following error on the client:
System.NullReferenceException: Object reference not set to an instance of an object.
On the line setting the name on the SOAP client below, info.Organization.Name = "Test Org";
Here is what I have so far:
SOAP Web Service
[WebMethod]
public string CoverageRequest(RequestorInformation info)
{
return info.Organization.Name;
}
public class RequestorInformation
{
public Organization Organization;
}
public class Organization
{
public Organization() {}
private string _Name;
public string Name
{
get { return _Name; }
set { _Name = value; }
}
}
SOAP Client
VerifyInsurance.RequestorInformation info = new VerifyInsurance.RequestorInformation();
info.Organization.Name = "Test Org";
VerifyInsurance verify = new VerifyInsurance();
verify.CoverageRequest(info);
|
|
|
|
|
The Organization present in the object info is null.
Try this
VerifyInsurance.RequestorInformation info = new VerifyInsurance.RequestorInformation();
info.Organization = new Organization();
info.Organization.Name = "Test Org";
VerifyInsurance verify = new VerifyInsurance();
verify.CoverageRequest(info);
This should work.
|
|
|
|
|
My requirement is to create a msi package for a web application and deploy it to the target machine which already has the virtual directory and app pool configured. Now evertime when i try to install the web application thru the msi package, the setup should not ask for any inputs from the user(meaning no UI interface should be involved) and the msi should be successfully installed.
Can anyone please help me out?? I have googled a lot. Not finding a proper solution
|
|
|
|
|
You can developed one custom installer for that. Few years back I developed one quite similar tool. you can have a look into this
Custom Control using C# For Virtual Directory in IIS[^]
You can use this as a reference to create a custom tool.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Thanks Abhijit. But then, in my target machine the Virtual directory and Application pool are already configured and i just have to create the msi package and install it in the target machine without any wizard for getting the inputs from the user during the installation process.
|
|
|
|
|
I am looking for a solution that would allow us to specify where the compiled code is located at, as well as all the servers are located at and it publish it out to there with a click of a button. This solution could also compile the code if not already prior to publishing it out there, but that is optional.
I am researching now how to see if this is possible in TFS.
Any ideas?
|
|
|
|
|
We have done the same requirement through CruiseControl .Net. You can google for Cruise COntrol to implement
|
|
|
|
|
I found this a few minutes ago and I'm currently installing it.
Thank you for the reply. I'll give it a test and see what it's like.
|
|
|
|
|
hey folks,
is there any .net webservice or something similar how I can check if some email is registered on facebook, twitter, linkedin, myspace?
Thx, Laziale
|
|
|
|
|
Hi,
I am developing project VirtualClassroom in C#,Asp.net framework 3.5,
How can i open the files like office document directly in asp.net page while taking online class...i am unable to open any document directly in asp.net page for online sharing of virtual classroom screen...
Please share some idea...
|
|
|
|
|
u mean to open the document which is in the client system? from server sied u cant, u need to use javascript, but it may not support in all browsers.. whats ur exact requirement???
|
|
|
|
|
hey sumit.... please contact me on <er.mukeshyadav@gmail.com>
Yush prakash u too...
|
|
|
|
|
hello sir,
i also want to build live video streaming application in my virtual classroom project ?
Could you please suggest me something?
|
|
|
|
|
I need virtual class room project in asp.net
|
|
|
|
|
Dear All,
I have a gridview with a dropdownlist inside a templatefield :
<asp:GridView ID="gvColumns" runat="server" AutoGenerateColumns="False" <br />
DataKeyNames="excelkolom"><br />
<Columns><br />
<asp:BoundField DataField="excelkolom" HeaderText="Excel kolommen" /><br />
<asp:TemplateField HeaderText="Database kolommen"><br />
<ItemTemplate><br />
<asp:DropDownList ID="ddlDbColumns" runat="server" AutoPostBack="true" <br />
DataSourceID="SqlDataSourceKhimportAll" DataTextField="Databasekolommen" <br />
DataValueField="Databasekolommen" <br />
OnSelectedIndexChanged="ddColumns_SelectedIndexChanged"><br />
</asp:DropDownList><br />
</ItemTemplate><br />
</asp:TemplateField><br />
</Columns><br />
</asp:GridView>
I want to get the text of the dropdownlist of the selected row:
string selection = gvColumns.Rows[gvColumns.SelectedRow.RowIndex].Cells[1].Text;
Im getting this error:
Object reference not set to an instance of an object.
How can i fix this?
Thanks in advance.
|
|
|
|
|
You have to use Gridview.FindControl() Method. Please do some research on it,you will able to resolve it by yourself.
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
You should try
String TextOfDropDownList = ((DropDownList)gvColumns.Rows[gvColumns.SelectedRow.RowIndex].FindControl("ddlDbColumns")).SelectedItem.Text hope it helps!!
|
|
|
|
|
I have a question in asp.net, in the page code behind when filling a gridview with data for example, i send a reference of the gridview to a controller class to fill it with data to avoid writing a lot of code in the page's code behind for example i write in the page load the following:
Controller.GetData(DataGridView);
does this mean i'm sending too much data from the client to the server? Is there a difference in performance between this and between filling the data in the page's code behind? in my opinion there's no difference, as this code already runs on the server and controls are created on the server, so no effect on the amount of data transferred from client to server. any ideas?
lamia
|
|
|
|
|
lamia nabil wrote: does this mean i'm sending too much data from the client to the server
What are you talking about ? ??
Is it a web service where you are sending the DataGridView ?
If it is just a class, then the object is already loaded in memory. You can process the memory wherever you want.
|
|
|
|
|
Hi,
No, it's not a web service, it's a regular web application, i'm newly working in web applications and some collegues argued with me about this,claiming that this will increase the load on the server and lower the performance beside that it's not correct to send controls between presentation and bussines layers, but i thought if i send a reference of all controls (in an arraylist) in my page to the bussines layer and filling the data goes there, i would minimize code written in the page to bind all controls, but actually i didn't see any one doing this before, so i'm not sure if this was a good idea.
lamia
|
|
|
|