Partial View with parametrized prefix for controls names

后端 未结 4 1016
情深已故
情深已故 2020-12-21 11:48

I have a BarEditor.ascx, that can be called from diffent places.

<%@ Control Language=\"C#\" Inherits=\"System.Web.Mvc.ViewUserControl

        
4条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-21 12:23

    I would pass a string ("baz" or "bar", etc) with my ViewData when calling the user control. Have the html.textbox get its name from the text passed and its value from the value passed.

提交回复
热议问题