web form gridview control
In a vb.net 2010 web form application, there is the following line of code in a <br />gridview control. <br /><asp:TemplateField HeaderText="Student Name" ItemStyle-HorizontalAlign="Center" <br />ItemStyle-CssClass="ui-widget-content" > <br /> <ItemTemplate > <br /> <a href="javascript: <br />GetStudentLetterTemplate('<%# Eval("schoolyear") %>', '<%# Eval("schoolnum") <br />%>', '<%# Eval("milestone_code") %>', '<%# Eval("stulink") %>', '<%# <br />Eval("HOMELNGCOR") %>', '<%# Eval("semester") %>');" <br />style="color:Blue"><%#Eval("STUDENTNAME")%></a> <br /> </ItemTemplate> <br /> </asp:TemplateField> <br /> <br />When the user clicks on this link, the user is directed to some javascript code <br />called GetStudentLetterTemplate. <br /> <br /> <br />Once in the javascript function, I want to display an error message to the user <br />saying basically saying there is duplicate data in the database. I want to then <br />want the function to 'return' so no processing by the user can occur. Note: the <br />duplicate data is created by the user by them using vendor software that I have <br />no control over. <br /> <br /> <br />The sql that I want to use is something like the following: <br /> <br /> #Region "Public Shared Function GetDupScoolYear" <br /> <WebMethod()> _ <br /> Public Shared Function GetDupScoolYear() As DataTable <br /> Dim _dt As DataTable = New DataTable() <br /> <br /> Dim Query As String = "SELECT [personID],value, count(*) as Count FROM <br /> [t].[dbo].[CustomStudent] where attributeID = 2775 and [personID] = 97366 group <br /> by [personID],value" <br /> Using con As SqlConnection = DB.OpenConnection() <br /> Using da As SqlDataAdapter = New SqlDataAdapter(Query, con) <br /> <br /> Try <br /> da.Fill(_dt) <br /> Catch ex As Exception <br /> <br /> End Try <br /> <br /> End Using <br /> End Using <br /> Return _dt <br /> End Function <br /> #End Region <br /> <br />Thus can you tell me or show me what I can do to solve the problem? Is there <br />possibly someway that I could call the code I listed above or similar code <br />before the java script code is called? <br /> <br /> <br />Basically would you tell me what I can do to solve this issue? <br /> <br />