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]
[quoted text, click to view] "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
>