开发者

error in using BtnSubmit.Attributes("onclick") in asp.net

开发者 https://www.devze.com 2023-01-10 23:19 出处:网络
can anybody tell me what is problem in BtnSubmit.Attributes(\"onclick\") = string.Format(\"document.getElementById(\\\'{0}\\\').value= document.getElementById(\\\'{1}\\\').value;\", this.HiddenField1

can anybody tell me what is problem in

BtnSubmit.Attributes("onclick") = string.Format("document.getElementById(\'{0}\').value= document.getElementById(\'{1}\').value;", this.HiddenField1.ClientID, this.FileUpload1.ClientID)开发者_开发知识库;

it is giving me error 'Non invocable memberusing System.Web.UI.WebControls.Attributes cannot be used like method.'


Please use Attributes properly. As it's an readonly property you can use it like this:

BtnSubmit.Attributes.Add("onclick", string.Format("document.getElementById(\'{0}\').value= document.getElementById(\'{1}\').value;", this.HiddenField1.ClientID, this.FileUpload1.ClientID));
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号