code:
ASP.NET does not seem to have data to DataGrid, however, however, in the application process, and I have packaged some functions in my work, I hope to be useful to everyone. I have made multiple heavy duty, and I have a variety of situations.
Public Enum ENUMCONTROLTYPE
CTLinkButton
CTIMAGEBUTTON
CTREQUIREDFIELDVALIDATOR
CTRADIOBUTTON
CTRANGEVALIDATOR
END ENUM
#Region "DataGrid Control"
Public Shared Sub ConfirmdbGridItemClick (Byval E as DataGriditeMeventArgs, _
Byval strname as string, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval udecontroltype as enumcontroltype = enumcontroltype.ctlinkButton, _
Optional byval strtooltip as string = "" "
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/27 14:38
'parameter::
':
'Back: Success, True, Converse, False
'Description:
ConfirmdbgridItemClick (E.Item, Strname, StrMessage, Strtext, BLnconfirm, BLNCUScript, StRCommandName, UDecontrolType, Strtooltip)
End Sub
Public Shared Sub ConfirmdblistItemClick (Byval E as DataListIventArgs, _
Byval strname as string, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval udecontroltype as enumcontroltype = enumcontroltype.ctlinkButton, _
Optional byval strtooltip as string = "" "
'Name: confirmdblistItemClick' Features: Confirm Table Route button (at the same time handling multilingual)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/27 14:38
'parameter::
':
'Back: Success, True, Converse, False
'Description:
ConfirmdblistItemClick (E.Item, Strname, StrMessage, Strtext, BLnconfirm, BLNCUScript, StRCommandName, UDecontrolType, Strtooltip)
End Sub
Public Shared Sub ConfirmdblistItemClick (byref dliitem as datalistItem, _
Byval strname as string, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval udecontroltype as enumcontroltype = enumcontroltype.ctlinkButton, _
Optional byval strtooltip as string = "" "
'Name: confirmdblistItemclick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
With dliitem
IF .InDex> = 0 THEN
SELECT CASE UDecontrolType
Case EnumControlType.ctLinkButton
DIM O_LKBITEM AS LINKBUTTON
O_LKBITEM = .findControl (Strname)
CONFIRMDBGRIDITEMCLICK (O_LKBITEM, STRMESSAGE, STRTEXT, BLNCONFIRM, BLNCUSTOMScript, STRCOMMAMMANDNAME, STRTOOL)
Case EnumControlType.ctimageButton
DIM O_IMBITEM As ImageButton
o_imbitem = .findControl (Strname)
ConfirmdbGridItemClick (O_Imbitem, StrMessage, Strtext, BLNConfirm, BLNCUScript, StRCommandname, STRTOOL)
Case EnumControlType.ctRequidfieldValidatorDim O_RFVItem As RequiredFieldValidator
o_rfvitem = .findControl (Strname)
ConfirmdbgridItemClick (O_RFVItem, StrMessage)
Case EnumControlType.ctiobutton
DIM O_RDBITEM As RadioButton
o_rdbitem = .findControl (Strname)
ConfirmdbGridItemClick (o_rdbitem, strtext)
Case EnumControlType.ctRregationValidator
Dim O_RDBITEM As RangevaliDator
o_rdbitem = .findControl (Strname)
ConfirmdbGridItemClick (o_rdbitem, strtext)
End SELECT
END IF
End with
End Sub
Public Shared Sub ConfirmdbGridItemClick (Byref DgiItem As DataGridItem, _
Byval strname as string, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval udecontroltype as enumcontroltype = enumcontroltype.ctlinkButton, _
Optional byval strtooltip as string = "" "
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
With dgiitem
IF .InDex> = 0 THEN
SELECT CASE UDecontrolType
Case EnumControlType.ctLinkButton
DIM O_LKBITEM AS LINKBUTTON
O_LKBITEM = .findControl (Strname)
CONFIRMDBGRIDITEMCLICK (O_LKBITEM, STRMESSAGE, STRTEXT, BLNCONFIRM, BLNCUSTOMScript, STRCOMMAMMANDNAME, STRTOOL)
Case EnumControlType.ctimageButton
DIM O_IMBITEM As ImageButton
o_imbitem = .findControl (Strname)
ConfirmdbGridItemClick (O_Imbitem, StrMessage, Strtext, BLnconfirm, BLNCUSTOMScript, StRCommandname, STRTOLTYPE.CTREQUIREDFIELDATORIDATOR
DIM O_RFVITEM as RequiredFieldValidator
o_rfvitem = .findControl (Strname)
ConfirmdbgridItemClick (O_RFVItem, StrMessage)
Case EnumControlType.ctiobutton
DIM O_RDBITEM As RadioButton
o_rdbitem = .findControl (Strname)
ConfirmdbGridItemClick (o_rdbitem, strtext)
End SELECT
END IF
End with
End Sub
Public Shared Sub ConfirmdbGridItemClick (byref rdbitem as radiobutton, _
Byval strText as string)
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
IF not rdbitem is nothing then
With rdbitem
.Text = strText
End with
END IF
End Sub
Public Shared Sub ConfirmdbGridItemClick (byref RFVItem As RangevaliDator, _
Byval strmessage as string)
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
IF not rfvitem is nothing then
With RFVItem
. ErrorMessage = StrMessage
End with
END IF
End Sub
Public Shared Sub ConfirmdbGridItemClick (byref RFVItem as RequiredFieldValidator, _
Byval strmessage as string)
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':' Return: Success, True, Converse, False
'Description:
IF not rfvitem is nothing then
With RFVItem
. ErrorMessage = StrMessage
End with
END IF
End Sub
Public Shared Sub ConfirmdbGridItemClick (Byref IMBB / AS ImageButton, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval strtooltip as string = "" "
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12
'Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
IF not objecton is nothing then
WITH IMBBUTTON
IF blnconfirm.
DIM O_STRScript as String
IF BLNCUSTOMScript then
o_strscript = strText
Else
o_strscript = "Return Confirm ('" & strugessage & ")"
END IF
.Attributes.add ("onclick", o_strscript)
END IF
.Commandname, strcommandname
.Tooltip = strtooltip
End with
END IF
End Sub
Public Shared Sub ConfirmdbGridItemClick (byref lkbbutton as linkbutton, _
Byval strmessage as string, _
Optional byval strText as string = "", _
Optional byval blnconfirm as boolean = true, _
Optional Byval BLNCUScript as boolean = false, _
Optional byval strcommandname as string = "", _
Optional byval strtooltip as string = "" "
'Name: confirmdbgridItemClick
'Features: Confirm the table row button (at the same time handling multiple languages)
'Author: chs
'Creating: 2004/4/12' Modification: 2004/4/29 09:33
'parameter::
':
'Back: Success, True, Converse, False
'Description:
IF not lkbbutton is nothing then
With lkbbutton
IF blnconfirm.
DIM O_STRScript as String
IF BLNCUSTOMScript then
O_STRScript = StrMessage 'strText
Else
o_strscript = "Return Confirm ('" & strugessage & ")"
END IF
.Attributes.add ("onclick", o_strscript)
END IF
.Text = strText
.Commandname = strandname
.Tooltip = strtooltip
End with
END IF
End Sub
#End region