|
I want to catch event when user close page.
And i expect to work just one time.
So i Write blow but it does work when page load.
How can i catch event?
protected void Page_UnLoad(object sender, EventArgs e)
{
}
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
you can use this to catch close event for the page using this.
< body onbeforeunload="alert('Closing');">
|
|
|
|
|
Function < body önbeforeunload="alert('Closing');">
is also working when I click other button(which make refresh page).
I want to execute .cs fuction when user close page or move other page.
Thank you!
hi
My english is a little.
anyway, nice to meet you~~
and give me your advice anytime~
|
|
|
|
|
With the help of Jquery you can call code behind function somthing like this
HTML Part:
<script src="jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
function confirmSubmit() {
$.ajax({
url: '/WebSite2/Default.aspx/SecretFormula',
type: 'POST',
contentType: 'application/json',
data: '{}',
success: function(result) {
alert(result.d);
}
});
alert("I am in ");
}
</script>
</head>
<body onbeforeunload="confirmSubmit()">
<form id="form1" runat="server">
<asp:scriptmanager id="ScriptMgr" runat="server" enablepagemethods="true">
<asp:button id="Button1" runat="server" text="Button">
</form>
</body>
</html>
Code Behind Function:
<WebMethod(EnableSession:=True), ScriptMethod()> _
Public Shared Function SecretFormula() As Integer
Return 42
End Function
|
|
|
|
|
I am looking for addititonal references for how to bind data to a C# detailsview 2010 web form control. Some of the links I have located so far are the following:
http://www.learn-asp.net/asptutorials/DetailsView.aspx
http://www.asp.net/data-access/tutorials/using-templatefields-in-the-detailsview-control-cs.
A standard linq datasource control can be connected to the detailsview control in standard situations as listed above. For data that is loaded into the detailviews control, I need to add 2 dropdown list controls values, data from an excel spreadsheet, and data obtained from tables not in the production database. Thus in this case, I am looking for additional refernces on how to bind these other references to the detailsview control when data is first loaded into the control.
|
|
|
|
|
Problem: I want the "TextBoxOrgName.Text" of a detailview control to contain the organization name.
I am working on a C# asp.net 2010 webform application. In a detailview control I want to place the organization name into the cell called "TextBoxOrgName.Text". The problem is I do not have the 'organization name' in the LinqDataSource1 listed below. I want setup a new linq data source to obtain the organization name value value listed below or place the value from a session variable here. Can you tell me how I could accomplish this goal?
[^] <asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"
EnableModelValidation="True" GridLines="Both"
AutoGenerateRows="False" DataSourceID="LinqDataSource1" BorderStyle="Solid"
HorizontalAlign="Center">
<Fields>
<asp:TemplateField HeaderText="Organization Name" >
<ItemTemplate>
<asp:TextBox ID="TextBoxOrgName" runat="server" Text='' BorderStyle="None" ></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Fields>
</asp:DetailsView>[^]
Here are a few additional notes:
1. I know the best solution probably would be to bring in value in linqdataource1. However the organization name column is not part of the table that I want to update in the sql server 2008 r2 database. I am thinking linqdataource1 should only be the table I want updated from this particular webpage correct?
2. This is a data entry application and the user enters the organization name on the first webpage. The user clicks the next button from the first page and now we are on the second data entry page. I have the organization name available on the second page as a session varirable obtained from the first page
|
|
|
|
|
Please use the correct tags (<pre></pre>) around your code; I don't understand why you think [^] is correct?
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
I thought [^] as the samething as (<pre></pre>) to put around the code. In the future, I use will (<pre></pre>) to put around my code.
|
|
|
|
|
|
SoftwareWarsaw wrote: maia.mekvabishvili@software.com.pl
You put your email address here and you work for a game magazine? I do hope you don't get inundated with spam from people attempting to get free adverts into your magazine.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
mark merrens wrote: I do hope you don't get inundated with spam
FTFY
Unrequited desire is character building. OriginalGriff
I'm sitting here giving you a standing ovation - Len Goodman
|
|
|
|
|
How do I search users in AD based on attribute?
I was able to get single user :
Dim cred as new NetworkCredential()
cre.UserName="mtID"
cre.Password="myPass"
cre.Domain="myDomain"
try
Using ladp as new LdapConnection("domain.domain.com")
ldap.Bind(cre)
Dim req as new searchRequest("CN=" & userName & ",OU=domain,DC=domain,DC=com","CN=" & userName, Protocol.SearchScope.Subtree)
Dim response as searchResponse= ladp.sendRequest(req)
....
|
|
|
|
|
I have a linq data source control question for a new C# web form 2010 application I am writing. I need to bring in one schedule date table and one main table to the .net 2010 control to display. The schedule table is based upon the current processing month and year. The main table is based upon what was entered on the orginal application web.
Would you setup two separate linq data source obejcts and point them to the appropriate cells in the web form control? Would you select all the data you need from the 2 unrelated tables in one linq statement and bring the data to the web form control? (The schedule dates are used to make data enter easier for the user. This keeps the user from having to enter dates.)
Can you tell how you suggest I accomplish this goal and point me to a references on how to complete my objective?
|
|
|
|
|
Hello guysss..pleas help me with thiss..i want to perform search in my sitee,,bt result should be show in searchresult.aspx page....
there are 8 pages in my site..when some one types anything on search of any of these pages the result must be show in searchresult.aspx page..
plzzz help me
|
|
|
|
|
|
hi everyone,
i want to create a blog service like blogger but i dont know how can do it and i have several problems:
1-when a user register in site,create a subdomain like username
(http://username.mysite.com).
2-what i need to know about speed(load a page).
|
|
|
|
|
When a user registers, create a subdirectory for him. This subdirectory must be mapped to the subdomain in the web server settings. And then add an entry for the subdomain to the domain name server.
These steps are pretty specific for the OS and server used.
|
|
|
|
|
|
Hi All,
I have following code in silverlight, I want to set max width for the StackPanel dynamically in xaml, but its not showing anything, means the width or max width value it is getting is "0". Basically I want to set the maxwidth of xaml to wrap the text inside the textblock
Foloowing is the Silverlight user control xaml:
<UserControl x:Class="TextBlockLayoutTest.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:converters="clr-namespace:ConvertersSilverlightClassLibrary;assembly=ConvertersSilverlightClassLibrary"
mc:Ignorable="d" x:Name="testUC">
<UserControl.Resources>
<converters:PercentageConverter x:Key="PercentageConverter"/>
</UserControl.Resources>
<Grid x:Name="grid">
<Grid.ColumnDefinitions>
<ColumnDefinition x:Name="gridCol1" Width="*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel Orientation="Vertical" Grid.Row="0" Grid.Column="0"
MaxWidth="{Binding ElementName=grid, Path=ActualWidth}">
<TextBlock TextWrapping="Wrap" >
test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test test
</TextBlock>
</StackPanel>
</Grid>
</UserControl>
public class PercentageConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
double d = System.Convert.ToDouble(value);
d = System.Convert.ToDouble(parameter);
return System.Convert.ToDouble(value) * System.Convert.ToDouble(parameter);
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
}
I tried to do the same using converters too, I binded my TextBlock width property with this PercentageConverter class still, the convert method is returning 0 so the textblock is becoming invisible. I tried in all the ways to wrap the text in side the textblock and show it accordning to the maxwidth of stack panel. In anyways its not becoming possible to wrap the text. We are implementing MVVM and Prism so we dont to implement code behind.
Can anybody please help me achieving this without using the code behind.
Thanks in advance.
Thanks & Regards,
Abdul Aleem Mohammad
St Louis MO - USA
|
|
|
|
|
Please use the Silverlight[^] forum for Silverlight/WPF questions hereafter.
|
|
|
|
|
Since I am working on a my second C# asp.net webforms page that I have ever done, I have the following question:
In a linq to sql connection that I setup with a datacontext object I did not include the organization table in the .dbml file since I received error messages that the objects in the table were already declared in the same namesapce. I can not remove the organization table from the other datacontext object since that other datacontext object is already used in production. (I am adding some webpages that will be a url link offf of the main company page. I want to use the general webssite namespace instead of creating my own to keep the coding easier.)
Basically what can I do to include some of the columns of the organzation table to be joined with the tables in the my new .dbml file.
|
|
|
|
|
In a C#asp.net 2010 detailsview and formveiw controls, I am asking what embedding various linq data source controls in certain cells. Basically I want to embed different datasources so the default dates will appear in diffeent data cells. This allows the user not to have to enter the date unless there are some excpetions. The data would come from different tables in different datacontext production areas. Is this possible? IF so, can you point me to links that I can use to see how to accomplish this task?
|
|
|
|
|
Hi guys, i really need your help because i have a little challenge. I'm working on a web based pharmacy management system. I need to restrict the pages depending on your type of user. For example, a doctor has access to only the prescription module, a store officer to inventory control and stock management, a Pharmacist to Dispensing and Billing Module, a pharmacy technician to Patient Registration while an administrator has access to all pages including User Registration.
I've created a table with four columns - UserName, Password, StaffID, Roles. There are five main roles as determined by the administrator which are Doctor, Pharmacy Techician, Pharmacist, Store Officer, Administrator.
How do i do this programmatically in C# ASP.NET? Thank you so much, Looking forward to your favourable reply
|
|
|
|
|
|