dc

dc

  • NA
  • 663
  • 0

web form gridview control

Aug 23 2016 10:23 PM
In a vb.net 2010 web form application, there is the following line of code in a <br />gridview control. <br />&lt;asp:TemplateField HeaderText="Student Name" ItemStyle-HorizontalAlign="Center" <br />ItemStyle-CssClass="ui-widget-content" &gt; <br /> &lt;ItemTemplate &gt; <br /> &lt;a href="javascript: <br />GetStudentLetterTemplate('&lt;%# Eval("schoolyear") %&gt;', '&lt;%# Eval("schoolnum") <br />%&gt;', '&lt;%# Eval("milestone_code") %&gt;', '&lt;%# Eval("stulink") %&gt;', '&lt;%# <br />Eval("HOMELNGCOR") %&gt;', '&lt;%# Eval("semester") %&gt;');" <br />style="color:Blue"&gt;&lt;%#Eval("STUDENTNAME")%&gt;&lt;/a&gt; <br /> &lt;/ItemTemplate&gt; <br /> &lt;/asp:TemplateField&gt; <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 /> &lt;WebMethod()&gt; _ <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 />

Answers (4)