본문 바로가기

Learning/Blazor

Blazor Component to Component Value change

<Component

ID="SID"

TARGETID="TARGETID"

Value="asasd">

</Component>

 

 

<Component

ID="TARGETID"

Value="123123">

</Component>

 

 

 

Component

<input id="@ID" class="e-input @InnerCssClass" type="text" @onchange="@onchange" value="@Value" onkeyup="FromToSetValue('@TARGETID', '@Value');"/>

 

        function FromToSetValue(TargetId, SourceValue) {
            if (TargetId != '') {
                //EnterKey Event
                if (window.event.keyCode == 13) {
                    const lbl = document.getElementById(TargetId);
                    lbl.value = SourceValue;
                    lbl.dispatchEvent(new Event("change"));
                }
            }
        }

 

'Learning > Blazor' 카테고리의 다른 글

Blazor 에서 EventHandler 이용하기  (0) 2021.05.07