BoldSignA modern eSignature application with affordable pricing. Sign up today for unlimited document usage!
@* rendering textbox and button, which is used to insert image link *@ @Html.TextBox("TextBox", "URL", new { style = "width: 300px;height:21px;" }) @Html.EJ().Button("button11").Text("Login").Size(ButtonSize.Normal).ShowRoundedCorner(true).ContentType(ContentType.ImageOnly).PrefixIcon("e-hyperlink").ClientSideEvents(e => e.Click("btnClick")) <div id="basicDialog" title="Image Browser"> <div id="fileExplorer"></div> </div> |
//rendering dialog $("#basicDialog").ejDialog({ showOnInit: false, height: "auto", width: "auto", enableResize: false }); //dialog object creation var dialogObj = $("#basicDialog").data("ejDialog"); //dialog will be opened with fileexplorer, while clicking insert url button function btnClick(args) { dialogObj.open(); if (!$("#basicDialog").find(".e-fileexplorer").length) { //rendering fileexplorer $("#fileExplorer").ejFileExplorer({ fileTypes: "*.png, *.gif, *.jpg, *.jpeg", height: 350, width: 800, layout: "list", path: "~/FileExplorerContent/", ajaxAction: "/FileExplorer/FileActionDefault", select: "updatePath" }); } } //path will be updated in textbox, while selecting files function updatePath(args) { $("#TextBox").val(args.path); } |
$("#TextBox").val(args.path);
}
I need to change it to a more generic approach and put somehow the id of the textbox in the arguments.
I've tried several options but can't get it to change.
I tried mis-using the Text property of the button, but that doesn't seems to work.
Could you please assist me once more?
Thanks for your help and for these great controls.
Paul
@Html.TextBox("TextBox", "URL", new { style = "width: 300px;height:21px;" }) @{IDictionary<string, object> parameters = new Dictionary<string, object>(); parameters.Add("data_textbox_id", "TextBox"); } @*here we have added custom attribute using HtmlAttributes API*@ @Html.EJ().Button("insertImageURL").Text("Login").HtmlAttributes(parameters).Size(ButtonSize.Normal).ShowRoundedCorner(true).ContentType(ContentType.ImageOnly).PrefixIcon("e-hyperlink").ClientSideEvents(e => e.Click("btnClick")) |
var updateTextBox; function btnClick(args) { //Here "data_textbox_id" attribute contains the corresponding textbox id updateTextBox = $("#" + this.element.attr("data_textbox_id")); } //path will be updated in corresponding textbox, while selecting files using fileexplorer function updatePath(args) { updateTextBox.val(args.path); |
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<div class="form-group">
@Html.EditorFor(model => model.AdImage, new { @class = "form-control" })
@Html.EJ().Button("btnAdImage").Text("AdImage").Size(ButtonSize.Normal).ShowRoundedCorner(true).ContentType(ContentType.ImageOnly).PrefixIcon("e-hyperlink").ClientSideEvents(e => e.Click("openImageBrowserClick"))
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Save" class="btn btn-default" />
</div>
</div>
<div id="basicDialog" title="Image Browser">
<div id="fileExplorer"></div>
</div>
</div>
}
@Html.EJ().Button("insertImageURL").Text("Login").Type(ButtonType.Button).HtmlAttributes(parameters).Size(ButtonSize.Normal).ShowRoundedCorner(true).ContentType(ContentType.ImageOnly).PrefixIcon("e-hyperlink").ClientSideEvents(e => e.Click("btnClick")) |