是否可以从js获取objectId参数并将其作为参数发送给Url操作?
JS:
function ButtonClick(objectId) {
App.testID.fireEvent("click", objectId);
}
Ext.net:
Html.X().ID("testID").DirectEvents
(
de =>
{
de.Click.Url = Url.Action("TestMethod", "TestController");
de.Click.ExtraParams.Add(new Parameter("objectId", "I need objectId here"));
}
)
答案 0 :(得分:0)
当我在调试器中看到编译后的代码时,我想到了不同的解决方案。 您可以这样创建直接事件:
Html.X().ID("testID")
.Listeners
(
l =>
{
l.AfterRender.Handler = @"App.testID.on('testEvent', function(id) {
Ext.net.directRequest({
url: '/TestController/TestMethod',
extraParams:
{
'objectId': id
}
});
});";
}
)
并用以下方法射击:
function ButtonClick(objectId) {
App.testID.fireEvent("testEvent", objectId);
}
答案 1 :(得分:0)
只需将原始代码添加为值字符串,然后将Sub GenerateFileLinks()
ActiveSheet.Cells.Clear
Dim objFSO As Object
Dim objFolder As Object
Dim objFile As Object
Dim i As Integer
'Create an instance of the FileSystemObject
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Get the folder object
Set objFolder = objFSO.GetFolder("C:\Users\jbishop\Desktop\SOPs With New Names")
i = 0
'Loop through each file in the directory
For Each objFile In objFolder.Files
'SOP ID Range
Set rngSOPID = Range(Cells(i + 1, 1), Cells(i + 1, 1))
'DeptCode Range
Set rngDeptCode = Range(Cells(i + 1, 2), Cells(i + 1, 2))
'URL Range
Set rngURL = Range(Cells(i + 1, 3), Cells(i + 1, 3))
'Lang Range
Set rngLang = Range(Cells(i + 1, 4), Cells(i + 1, 4))
Set Filename = Split(objFile.Name, "-")
'Create hyperlink in each cell
ActiveSheet.Hyperlinks.Add Anchor:=rngURL, Address:=objFile.Path, TextToDisplay:=Filename(4)
i = i + 1
Next objFile
End Sub
添加到ParameterMode.Raw
实例中,如下所示:
Parameter
(基于Error Substate documentation)
或者,一个自定义对象:
de.Click.ExtraParams.Add(new Parameter("objectId", "App.MyComponent.Id", ParameterMode.Raw));