linkbutton and modelpopup

I have a link button inside the dynamic datagrid, when it is clicks this modelpopup will be showing it will have only one dropdown and ok button cancel button. How can I do? I thought I need to use this code above, but I don't know where to put the code inside the datagrid or outside? If it  is long thing I 'll be glad to create a new question?
found this , don't know how to implement it..

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server"
    TargetControlID="LinkButton1"
    PopupControlID="Panel1"
    BackgroundCssClass="modalBackground"
    DropShadow="true"
    OkControlID="OkButton"
    OnOkScript="onOk()"
    CancelControlID="CancelButton"
    PopupDragHandleControlID="Panel3" />
jaws1021Asked:
Who is Participating?
 
chinu1310Commented:
Ok.
Do it this way.

<asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return ClientShowModal();" Text="Show Modal" CommandName="Select" />

Add just CommandName="Select" in your column.

Than add this code on selected index change

 GridViewRow dr = Grid1.SelectedRow;
        string valiue = dr.Cells[1].Text;
dr.Cells[1] = "Your datakey item"

Now pass this to dropdown and link button.

Hope I am understood you correct.
0
 
chinu1310Commented:
As I said on previous thread.

On the link button event of gridview:

AjaxControlToolkit.PopupExtender pi = new AjaxControlToolkit.PopupExtender();
pi.TargetControlID = GridView1;

Try something like this.
0
 
jaws1021Author Commented:
I am not sure still, do you have a example demonstrating this..
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
chinu1310Commented:
0
 
jaws1021Author Commented:
did this stuff and cannot see any pop up

this is in datagrid

<asp:TemplateColumn HeaderText="link" >

<ItemTemplate>

<asp:LinkButton ID="LinkButton1" OnClientClick = "ShowModalPopup()" runat="server">Click here to choose Error Reason</asp:LinkButton>


</ItemTemplate>

</asp:TemplateColumn>

then I called this on server side

Public Function ShowModalPopup()

MPE.Show()

End Function

then I put this code after datagrid and updatepanel and contenttemplate

<asp:Panel ID="Panel1" runat="server" Height="104px" Width="233px" style="z-index: 100; left: 298px; position: absolute; top: 126px">

&nbsp;

<asp:DropDownList ID="DropDownList1" runat="server" style="z-index: 100; left: 0px; position: absolute; top: 0px" Width="188px">

</asp:DropDownList>

<asp:Button ID="Button1" runat="server" Style="z-index: 101; left: 3px; position: absolute;

top: 38px" Text="Button" />

<asp:Button ID="Button2" runat="server" Style="z-index: 103; left: 79px; position: absolute;

top: 35px" Text="Button" />


</asp:Panel>

<asp:Button ID="FakePopButton" runat="server" style="display:none;" />&nbsp;

<ajaxToolkit:ModalPopupExtender ID="MPE" runat="server" BackgroundCssClass="modalBackground"

TargetControlID="FakePopButton" PopupControlID="Panel1"

CancelControlID="CancelButton" />

can not even see my panel pop up, what am I doing wrong?
0
 
chinu1310Commented:
Can I see your code behind ?
0
 
jaws1021Author Commented:
that's all for server side

Public Function ShowModalPopup()

MPE.Show()

End Function
0
 
jaws1021Author Commented:
have a warning saying Warning      1      Function 'ShowModalPopup' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.      
and when I put my cursor on link button I can see javascript error below..I see this below the page

Javascript:_doPostBack('dg$ct02$Linkbutton1',")  and says object expected..
0
 
chinu1310Commented:
What we do is when a button is clicked in the gridview we create one new gridview row.

Than dynamically create the Ajax Popup Extender and place it in the new row.

And display contents in it. Do some google on this idea. Will post back if I find something.
0
 
jaws1021Author Commented:
When checkbox clicks inside the datagrid, I will make linkbutton which is also in datagrid will be clickable, and when user clicks linkbutton it will pop up panel having dropdown in it..
0
 
jaws1021Author Commented:
I have found a good code it is working good. Now I need if you can help me on that , grab a which rows linkbutton clicked, so I can fill dropdown inside the panel..



<asp:GridView ID="Grid1" runat="server" >
   <Columns>
                <asp:TemplateField>
                    <ItemTemplate>
                        <asp:LinkButton ID="LinkButton1" runat="server" OnClientClick="return ClientShowModal();" Text="Show Modal" />
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>

<asp:Panel ID="NotePopup" runat="server" CssClass="modalPopup" style="display:none;">
            <h1>A Note</h1>
            <p>Yes this is a modal popup</p>
</asp:Panel>
        <asp:Button ID="FakeNote" runat="server" style="display:none;" />
        <ajaxToolkit:ModalPopupExtender ID="notempe" runat="server" BackgroundCssClass="modalBackground"
            TargetControlID="FakeNote" PopupControlID="NotePopup" BehaviorID="ModalBehaviour"  />

<script type="text/javascript">
       
        function ClientShowModal()
        {
            $find("ModalBehaviour").show();
            return false;
        }
0
 
chinu1310Commented:
Sure.

 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow dr = GridView1.SelectedRow;
        string  valiue = dr.Cells[0].Text;
    }

Define your linkbutton filed this way.

<asp:ButtonField Text="Select" CommandName="Select" />

done.
0
 
jaws1021Author Commented:
Lets back up for second, I have above working code, I have added my dropdown, so when user clicks checkbox linkbutton enables, I have done that already, at that point I have the value that I want to pass to link button and then of course use this same value to fill dropdown with my Fill_dropdown function. I need to understand how can I pass this value to first link than dropdown?
0
 
jaws1021Author Commented:
Add just CommandName="Select" in your column.
what that does? what would happen if I didn't put that?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.