Ask a Question related to ASP.NET Building Controls, Design and Development.
-
verci #1
Newbie, how to display a messagebox always on top
Hi, sorry if this seems stupid, please have patience.
I'm running Win XP sp2, VS 2005 Tem, SQL Sever 2005, I've been using a
gridview to display my DB information, on the Gridview_RowUpadating event
handler I validate if the value entered already exist en the DB using the
following.
Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.RowUpdating
Dim valor As String = e.NewValues("ProductName").ToString
If RunQueryDr(valor) = True Then
e.Cancel = True
MsgBox("This value already exist!", MsgBoxStyle.ApplicationModal +
MsgBoxStyle.Critical, "Error")
Return
End If
End Sub
I want to display the message box always on top of other windows, so the
user can't minimize it or even worst keep trying to update the record and
thus opening various error message boxes, I've tried the JavaScript
openwindow and alert functions with no success.
Thanks
verci Guest
-
Creating a yes/no messagebox in Javascript
Hi all, Is it possible to create a Javascript messagebox that shows the buttons Yes and No instead of normal confirm? Regards John. -
Newbie: How to get and display counts?
I have a web page in which I want to display the count of records in a particular table. For example: <?php @ $db =... -
Newbie needs help with diary display
Hi There, I'm currently trying to create a database driven intranet diary. I'm pretty much there with it, however there is one little problem that... -
Newbie needs to read CSV or TSV value and display in a web page
As the subject says, I need to be able to read a CSV or TSV file and display the results on a web page. I am currently reading the Learning Perl... -
messagebox inside ASP page
How can I send messages to user like messageBox from a ASP page without doing postback over the page. thanks for your help Oscar -
Eliyahu Goldin #2
Re: Newbie, how to display a messagebox always on top
A simple answer is that javascript alert function is the way to go. You can
pass the message to show to the client-side where it can be picked up and
displayed. The standard way of passing information between server and client
is using hidden input controls. Put this line in your web form:
<input type="hidden" runat="server" id="inhMessage"/>
The server code will set the message as
inhMessage.Value="This value already exist!"
The client code will access it as
<script>
function checkMessage(){
if(myForm.inhMessage.Value<>'')
{
alert(myForm.inhMessage.Value);
myForm.inhMessage.Value='';
}
}
</script>
....
<body onload='checkMessage()'/>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"verci" <iodataser@yahoo.com> wrote in message
news:%238DUqWc1GHA.4632@TK2MSFTNGP03.phx.gbl...> Hi, sorry if this seems stupid, please have patience.
>
> I'm running Win XP sp2, VS 2005 Tem, SQL Sever 2005, I've been using a
> gridview to display my DB information, on the Gridview_RowUpadating event
> handler I validate if the value entered already exist en the DB using the
> following.
>
> Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
> System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
> GridView1.RowUpdating
>
> Dim valor As String = e.NewValues("ProductName").ToString
>
> If RunQueryDr(valor) = True Then
>
> e.Cancel = True
>
> MsgBox("This value already exist!", MsgBoxStyle.ApplicationModal +
> MsgBoxStyle.Critical, "Error")
>
> Return
>
> End If
>
> End Sub
>
> I want to display the message box always on top of other windows, so the
> user can't minimize it or even worst keep trying to update the record and
> thus opening various error message boxes, I've tried the JavaScript
> openwindow and alert functions with no success.
>
> Thanks
>
Eliyahu Goldin Guest
-
Eliyahu Goldin #3
Re: Newbie, how to display a messagebox always on top
Javascript is case-sencitive. Should be
function checkMessage(){
if(myForm.inhMessage.value<>'')
{
alert(myForm.inhMessage.value);
myForm.inhMessage.value='';
}
}
If you still get error messages, specify the error text.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"verci" <iodataser@yahoo.com> wrote in message
news:e5O6OVp1GHA.1256@TK2MSFTNGP02.phx.gbl...> Hi
> Can you please take a look at my code , what am I doing wrong? I get 2
> error messages :
>
>
> <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb"
> Inherits="Default3" %>
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>
> <html xmlns="http://www.w3.org/1999/xhtml" >
>
> <head runat="server">
>
> <title>Untitled Page</title>
>
> <script>
>
> function checkMessage(){
>
> if(myForm.inhMessage.Value<>'')
>
> {
>
> alert(myForm.inhMessage.Value);
>
> myForm.inhMessage.Value='';
>
> }
>
> }
>
> </script>
>
> </head>
>
> <body onload='checkMessage()'>
>
> <form id="form1" runat="server">
>
> <input type="hidden" runat="server" id="inhMessage"/>
>
> <div>
>
> <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
> AutoGenerateColumns="False"
>
> DataKeyNames="ProductID" DataSourceID="SqlDataSource1">
>
> <Columns>
>
> <asp:BoundField DataField="ProductID" HeaderText="ProductID"
> InsertVisible="False"
>
> ReadOnly="True" SortExpression="ProductID" />
>
> <asp:TemplateField HeaderText="ProductName" SortExpression="ProductName">
>
> <EditItemTemplate>
>
> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProductName")
> %>'></asp:TextBox>
>
> <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
> ControlToValidate="TextBox1"
>
> ErrorMessage="Valor requerido"
> Text="*"></asp:RequiredFieldValidator>
>
> </EditItemTemplate>
>
> <ItemTemplate>
>
> <asp:Label ID="Label1" runat="server" Text='<%# Bind("ProductName")
> %>'></asp:Label>
>
> </ItemTemplate>
>
> </asp:TemplateField>
>
> <asp:CommandField ShowEditButton="True" />
>
> </Columns>
>
> </asp:GridView>
>
>
>
> <asp:ValidationSummary ID="ValidationSummary1" runat="server"
> Style="z-index: 100;
>
> left: 449px; position: absolute; top: 37px" DisplayMode="List"
> Font-Bold="True" ShowMessageBox="True" ShowSummary="False" />
>
>
>
> <asp:SqlDataSource ID="SqlDataSource1" runat="server"
> ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
>
> SelectCommand="SELECT [ProductID], [ProductName] FROM [Products] order by
> ProductID"
>
> UpdateCommand="Update Products set ProductName=@Productname where
> ProductID=@ProductID"></asp:SqlDataSource>
>
> </div>
>
> </form>
>
> </body>
>
> </html>
>
>
>
> "Eliyahu Goldin" <REMOVEALLCAPITALSeEgGoldDinN@mMvVpPsS.org> wrote in
> message news:uhVkLCk1GHA.480@TK2MSFTNGP06.phx.gbl...>>>A simple answer is that javascript alert function is the way to go. You
>>can
>> pass the message to show to the client-side where it can be picked up and
>> displayed. The standard way of passing information between server and
>> client
>> is using hidden input controls. Put this line in your web form:
>> <input type="hidden" runat="server" id="inhMessage"/>
>>
>> The server code will set the message as
>>
>> inhMessage.Value="This value already exist!"
>>
>> The client code will access it as
>> <script>
>> function checkMessage(){
>> if(myForm.inhMessage.Value<>'')
>> {
>> alert(myForm.inhMessage.Value);
>> myForm.inhMessage.Value='';
>> }
>> }
>> </script>
>> ...
>> <body onload='checkMessage()'/>
>>
>> --
>> Eliyahu Goldin,
>> Software Developer & Consultant
>> Microsoft MVP [ASP.NET]
>>
>>
>> "verci" <iodataser@yahoo.com> wrote in message
>> news:%238DUqWc1GHA.4632@TK2MSFTNGP03.phx.gbl...>>>>> Hi, sorry if this seems stupid, please have patience.
>>>
>>> I'm running Win XP sp2, VS 2005 Tem, SQL Sever 2005, I've been using a
>>> gridview to display my DB information, on the Gridview_RowUpadating
>>> event
>>> handler I validate if the value entered already exist en the DB using
>>> the
>>> following.
>>>
>>> Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
>>> System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
>>> GridView1.RowUpdating
>>>
>>> Dim valor As String = e.NewValues("ProductName").ToString
>>>
>>> If RunQueryDr(valor) = True Then
>>>
>>> e.Cancel = True
>>>
>>> MsgBox("This value already exist!", MsgBoxStyle.ApplicationModal +
>>> MsgBoxStyle.Critical, "Error")
>>>
>>> Return
>>>
>>> End If
>>>
>>> End Sub
>>>
>>> I want to display the message box always on top of other windows, so the
>>> user can't minimize it or even worst keep trying to update the record
>>> and
>>> thus opening various error message boxes, I've tried the JavaScript
>>> openwindow and alert functions with no success.
>>>
>>> Thanks
>>>
>>
>
>
Eliyahu Goldin Guest



Reply With Quote

