In a vb.net 2010 web form application, there is the following line of code in a
gridview control.
<asp:TemplateField HeaderText="Student Name" ItemStyle-HorizontalAlign="Center"
ItemStyle-CssClass="ui-widget-content" >
<ItemTemplate >
<a href="javascript:
GetStudentLetterTemplate('<%# Eval("schoolyear") %>', '<%# Eval("schoolnum")
%>', '<%# Eval("milestone_code") %>', '<%# Eval("stulink") %>', '<%#
Eval("HOMELNGCOR") %>', '<%# Eval("semester") %>');"
style="color:Blue"><%#Eval("STUDENTNAME")%></a>
</ItemTemplate>
</asp:TemplateField>
When the user clicks on this link, the user is directed to some javascript code
called GetStudentLetterTemplate.
Once in the javascript function, I want to display an error message to the user
saying basically saying there is duplicate data in the database. I want to then
want the function to 'return' so no processing by the user can occur. Note: the
duplicate data is created by the user by them using vendor software that I have
no control over.
The sql that I want to use is something like the following:
#Region "Public Shared Function GetDupScoolYear"
<WebMethod()> _
Public Shared Function GetDupScoolYear() As DataTable
Dim _dt As DataTable = New DataTable()
Dim Query As String = "SELECT [personID],value, count(*) as Count FROM
[t].[dbo].[CustomStudent] where attributeID = 2775 and [personID] = 97366 group
by [personID],value"
Using con As SqlConnection = DB.OpenConnection()
Using da As SqlDataAdapter = New SqlDataAdapter(Query, con)
Try
da.Fill(_dt)
Catch ex As Exception
End Try
End Using
End Using
Return _dt
End Function
#End Region
Thus can you tell me or show me what I can do to solve the problem? Is there
possibly someway that I could call the code I listed above or similar code
before the java script code is called?
Basically would you tell me what I can do to solve this issue?
Loading
dcPosted Aug 24, 2016, 11:59 AM
Gridview thank you! However I have the following additional questions:
1. Am I suppose to use any/all of the following for what you are suggesting;
onpageindexchanging="gvPerson_PageIndexChanging"
onrowcancelingedit="gvPerson_RowCancelingEdit"
onrowdatabound="gvPerson_RowDataBound"onrowdeleting="gvPerson_RowDeleting"
onrowediting="gvPerson_RowEditing"onrowupdating="gvPerson_RowUpdating"
onsorting="gvPerson_Sorting
dcPosted Aug 24, 2016, 11:39 AM
Thanks for your answer so far!
Would you show me the code and/or point me to urls (links) that will tell me how to accomplish the following tasks:
Midhun TpPosted Aug 23, 2016, 11:54 PM
Ajay MalikPosted Aug 23, 2016, 11:52 PM