[ ) Assign a Textbox Value to the modal-box on the same page
NEW QUESTION:
Why did the button in the modal box not work when I pressed the button? Am I missing something?
I added code to handle the server side click event:
Protected Sub Save_Button_Click(sender As Object, e As System.EventArgs) Handles Save_Button.Click
End Sub
Pls see the code below with the line marked.
I have the code below to show modal-box after clicking LinkButton. And, what I want to do is how to assign a Textbox value using.
I have a gridview:
<asp:GridView ID="GV1" runat="server" DataSourceID="DS1" >
<Columns>
<asp:BoundField HeaderText="ID" DataField="ID"/>
<asp:TemplateField ShowHeader="False">
<ItemTemplate>
<asp:LinkButton ID="Edit_Linkbutton" runat="server" CausesValidation="False" >
<asp:Image ID="Edit_Linkbutton_Image" runat="server" ImageUrl="~/edit.png"></asp:Image>
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
And on the same page (this is a div as a modal box that will be shown after clicking Linkbutton on the Gridview):
<div id="dialog-form" title="Modal Box">
<input type="text" id="Textbox1" />
#--------------------------------------------------------------------#
#This button didn't get fired while clicked
<asp:Button ID="Save_Button" runat="server" Text="Save"></asp:Button>
#--------------------------------------------------------------------#
</div>
And then I attach the Javascript function to LinkButton through the code:
Dim myLinkButton As LinkButton
For i As Integer = 0 To GV1.Rows.Count - 1
myLinkButton = DirectCast(GV1.Rows(i).Cells(1).FindControl("LinkButton"), LinkButton)
myLinkButton.Attributes.Add("onclick", "shopModalPopup('" + .Rows(i).Cells(0).Text & "'); return false;")
Next
Rows(i).Cells(0)- This is the first column in Gridview, it is " ID".
Javascript code is on the same page as the Gridview code:
<script>
function shopModalPopup(id){
$("#dialog-form").dialog("open");
}
$(function () {
$("#dialog-form").dialog({
autoOpen: false,
height: 300,
width: 350,
modal: true
});
});
</script>
, Textbox1 .
, ID Textbox1 ? , . , Linkbutton. ? .