Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello All,

how to show Gridvew on modalpopextender in c#
Posted

 
Share this answer
 
Take a Panel
put gridview on panel
use modelpopup extender
and
use
C#
PopupControlId="panel1"


see Example
Ajax ModalPopup
 
Share this answer
 
Comments
CodePrakash 24-Jan-12 2:20am    
thankyou very much Uma,

but how to bind grid view? didnt fire button event.
uspatel 24-Jan-12 2:23am    
are you bind this by SqlDataSource or codeBehind?
and where button event not fired on Panel or web page.
share code?
CodePrakash 24-Jan-12 2:29am    
see below code
uspatel 24-Jan-12 2:34am    
See Causevalidation Proprty of this button and make false,
then try to debug
protected void btnSemister_Click(object sender, ImageClickEventArgs e)
{
BindgridCource();
this.ModalPopupExtender1.Show();

}
CodePrakash 24-Jan-12 2:40am    
popup show hota hai. lekin bindgrid code execute nahi hota.
<table width="760px" cellpadding="0" cellspacing="0" align="center" class="formborder">
<tr>
<td class="formtop" height="42px" colspan="2">
&nbsp;&nbsp;&nbsp; Add Course
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Course Name :
</td>
<td>
<asp:TextBox ID="txtCourse" runat="server" CssClass="textbox" Width="263px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Course Code :
</td>
<td>
<asp:TextBox ID="txtCourseCode" runat="server" CssClass="textbox" Width="263px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Course Description :
</td>
<td>
<asp:TextBox ID="txtDesc" runat="server" CssClass="txtmultiline" TextMode="MultiLine"
Rows="4" Width="260px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Course Duration :
</td>
<td>
<asp:TextBox ID="txtDuration" runat="server" CssClass="textbox" Width="263px"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Syllabus Attachment :
</td>
<td>
<asp:FileUpload ID="Fileupload1" runat="server" CssClass="textbox" Width="263px" />
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td class="formlable">
Select Semister :
</td>
<td>
<asp:DropDownList ID="drpSemister" runat="server" CssClass="textbox" Width="263px">
<asp:ListItem>-Select-</asp:ListItem>
</asp:DropDownList>
<asp:ImageButton ID="btnSemister" runat="server"
ImageUrl="~/images/btn_add.gif" onclick="btnSemister_Click" />
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="2">
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" CancelControlID="btnCancel"
OkControlID="btnOkay" TargetControlID="btnSemister" PopupControlID="Panel1" PopupDragHandleControlID="PopupHeader"
Drag="true" BackgroundCssClass="ModalPopupBG">
</asp:ModalPopupExtender>
<asp:Panel ID="Panel1" runat="server" Style="display: none">
<div class="HellowWorldPopup">
<div class="PopupHeader" id="PopupHeader">
Header</div>
<div class="PopupBody">
<p>
This is a simple modal dialog</p>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:Panel ID="pnlCourse" CssClass="panel" runat="server" Height="200px" Width="750px"
ScrollBars="Both">
<asp:GridView ID="grdCourse" runat="server" Width="100%" AutoGenerateColumns="false"
CssClass="gridview">
<Columns>
</Columns>
<EmptyDataTemplate>
Sorry No Data Found !</EmptyDataTemplate>
</asp:GridView>
</asp:Panel>
</td>
</tr>
</table>
</div>
<div class="Controls">
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Button ID="btnOkay" runat="server" Text="Done" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</div>
</div>
</asp:Panel>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="~/images/submitbutton.png" />&nbsp;
<asp:ImageButton ID="btnCancels" runat="server" ImageUrl="~/images/cancelbutton.png" />
</td>
</tr>
<tr>
<td colspan="2">
&nbsp;
</td>
</tr>
</table>


********************************************

protected void BindgridCource()
{
var cource = from c in es.ELCourseMasters select c;
grdCourse.DataSource = cource;
grdCourse.DataBind();
}

protected void btnSemister_Click(object sender, ImageClickEventArgs e)
{
BindgridCource();
}


not fire btnSemister_Click this event
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900