Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Newbie, how to display a messagebox always on top

Reply
Thread Tools

Newbie, how to display a messagebox always on top

 
 
verci
Guest
Posts: n/a
 
      09-11-2006
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


 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      09-12-2006
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" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      09-13-2006
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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>&nbsp;
>
> </EditItemTemplate>
>
> <ItemTemplate>
>
> <asp:Label ID="Label1" runat="server" Text='<%# Bind("ProductName")
> %>'></asp:Label>
>
> </ItemTemplate>
>
> </asp:TemplateField>
>
> <asp:CommandField ShowEditButton="True" />
>
> </Columns>
>
> </asp:GridView>
>
> &nbsp; &nbsp;
>
> <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" />
>
> &nbsp;
>
> <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" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
>>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" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>>> 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
>>>

>>
>>

>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
Newbie, how to display a messagebox always on top verci ASP .Net Building Controls 2 09-13-2006 08:59 AM
How to display "Dont show again" checkbox in messagebox soundar rajan ASP .Net 2 02-24-2005 12:03 PM
how to display a number in a messagebox? sdeyoreo@hotmail.com C++ 3 01-16-2005 12:37 AM
how to display a MessageBox in ASP.net Paul Wilson ASP .Net 3 06-21-2004 04:40 AM



Advertisments