model pop extender problem..

Posted by Bhanubysani under ASP.NET AJAX on 4/27/2011 | Points: 10 | Views : 2481 | Status : [Member] | Replies : 9
hi iam facing a problem..iam dispalying user details as gridview..when user want edit i put a link button..when user click taht button iam dispalying a model pop extender..my problem is first time it is not dispalying its details..but second time it is displaying details..

plz help me

Regards,
Bhanu Prakash Bysani



Responses

Posted by: Tijut2k on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
Could u plz show the code

Best Regard's
Tiju Thankachan

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhanubysani on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
ASPX PAGE:--
-------------------
<asp:GridView ID="GVListings" runat="server" DataKeyNames="ypid" AllowPaging="True"
PageSize="10" AutoGenerateColumns="False" CssClass="gridview" Width="100%" OnRowDeleting="GVListings_RowDeleting"
OnPageIndexChanging="GVListings_PageIndexChanging">
<Columns>

<asp:TemplateField HeaderText="ID" HeaderStyle-CssClass="gridview_header" ItemStyle-CssClass="gridview_text"
ItemStyle-Width="50px">
<ItemTemplate>
<asp:LinkButton ID="lnkypid" runat="server" Text='<%# Eval("YPID") %>' OnClick="lnkCustDetails_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Category" HeaderText="category" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="SubCategory" HeaderText="subcategory" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="Companyname" HeaderText="companyname" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
</Columns>
</asp:GridView>

model popup extender code:--
----------------------------------------------
<asp:Button runat="server" ID="btnShowModalPopup" Style="display: none" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="divPopUp"
TargetControlID="btnShowModalPopup" BackgroundCssClass="popUpStyle" PopupDragHandleControlID="panelDragHandle"
DropShadow="true" />
<br />
<div class="popUpStyle" id="divPopUp" style="display: none;">
<asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag">
<asp:Button ID="btnClose" runat="server" Text="Close" />
<asp:Label runat="server" ID="lblText" Text="CustomerID: "></asp:Label>
<asp:Label ID="lblCustValue" runat="server"></asp:Label>
</div>
aspx.cs:--
------------------
protected void lnkCustDetails_Click(object sender, EventArgs e)
{
// Fetch the customer id
LinkButton lb = sender as LinkButton;
string custID = lb.Text;
LPOBJ.L_YPID = Convert.ToInt32(custID);
// Connection
lblCustValue.Text = custID;
ModalPopupExtender1.Show();
}

Regards,
Bhanu Prakash Bysani

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Tijut2k on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
You have to fill the grid GVListings before calling ModalPopupExtender1.Show();

Best Regard's
Tiju Thankachan

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 4/27/2011 [Member] Starter | Points: 25

Up
0
Down
Please take a look at the attached sample which imitate your functionality.
 Download source file

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhanubysani on: 4/29/2011 [Member] Starter | Points: 25

Up
0
Down
source code is working fine..but my problem is not solved.

Regards,
Bhanu Prakash Bysani

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ndebata on: 4/29/2011 [Member] Starter | Points: 25

Up
0
Down
Could you send/attach both aspx and .cs file?

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhanubysani on: 4/29/2011 [Member] Starter | Points: 25

Up
0
Down
sorry the code is not attching..how can i attch my c\source code..even zip file is not attching..


Regards,
Bhanu Prakash Bysani

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhanubysani on: 4/29/2011 [Member] Starter | Points: 25

Up
0
Down
ASPX PAGE:--
-------------------
<table width="500px" cellpadding="0" cellspacing="2" border="0">
<tr class="RowStyle">
<td class="tdStyle">
<asp:Label ID="lblUserID" runat='server' Text="Enter Company Name "></asp:Label>
</td>
<td class="tdStyle">
<asp:TextBox ID="txtCompanyName" runat="server" CssClass="TextBox" Width="300px"></asp:TextBox>
</td>
</tr>
<tr class="AlternateRowStyle">
<td colspan="2" align="center">
<asp:Button ID="btnSearch" runat="server" OnClick="btnSearch_Click" OnClientClick="return FormValidation();"
Text="Search" />
</td>
</tr>
</table>
<asp:GridView ID="GVListings" runat="server" DataKeyNames="ypid" AllowPaging="True"
PageSize="10" AutoGenerateColumns="False" CssClass="gridview" Width="100%" OnRowDeleting="GVListings_RowDeleting"
OnPageIndexChanging="GVListings_PageIndexChanging">
<Columns>

<asp:TemplateField HeaderText="ID" HeaderStyle-CssClass="gridview_header" ItemStyle-CssClass="gridview_text"
ItemStyle-Width="50px">
<ItemTemplate>
<asp:LinkButton ID="lnkypid" runat="server" Text='<%# Eval("YPID") %>' OnClick="lnkCustDetails_Click"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Category" HeaderText="category" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="SubCategory" HeaderText="subcategory" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="Companyname" HeaderText="companyname" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
<asp:BoundField DataField="ContactName" HeaderText="ContactName" HeaderStyle-CssClass="gridview_header"
ItemStyle-CssClass="gridview_text" />
</Columns>
</asp:GridView>

model popup extender code:--
----------------------------------------------
<asp:Button runat="server" ID="btnShowModalPopup" Style="display: none" />
<asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" PopupControlID="divPopUp"
TargetControlID="btnShowModalPopup" BackgroundCssClass="popUpStyle" PopupDragHandleControlID="panelDragHandle"
DropShadow="true" />
<br />
<div class="popUpStyle" id="divPopUp" style="display: none;">
<asp:Panel runat="Server" ID="panelDragHandle" CssClass="drag">
<asp:Button ID="btnClose" runat="server" Text="Close" />
<asp:Label runat="server" ID="lblText" Text="CustomerID: "></asp:Label>
<asp:Label ID="lblCustValue" runat="server"></asp:Label>
</div>

Regards,
Bhanu Prakash Bysani

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Bhanubysani on: 4/29/2011 [Member] Starter | Points: 25

Up
0
Down
aspxpage.cs:--
---------------------
protected void Page_Load(object sender, EventArgs e)
{

string userID = string.Empty;

if (Session["UserID"] != null && Session["UserID"] != "")
{

LPOBJ.L_UserID = Convert.ToString(Session["UserID"]);
UPOBJ.U_UserType = Convert.ToInt32(Session["UserType"]);


}
else
{
Response.Redirect("~/Login.aspx?ReturnUrl=" + Request.Url.PathAndQuery.Replace("&", "^"));
}
if (!IsPostBack)
{
SqlDataReader drCategory;
drCategory = ABLOBJ.GetDistinctCategories();

if (drCategory.HasRows)
{
while (drCategory.Read())
{
ddlCategory.Items.Add(drCategory.GetString(0));
}
}
drCategory.Dispose();
drCategory.Close();

SqlDataReader drAreas;
drAreas = ABLOBJ.GetTotalAreas(LPOBJ);
if (drAreas.HasRows)
{
while (drAreas.Read())
{
ddlArea.Items.Add(drAreas.GetString(0));
}
}

drAreas.Close();
}

}
private void GetData()
{
dsShowListings = ABLOBJ.GetBusinessListingsByCompanyName(LPOBJ);

GVListings.DataSource = dsShowListings;
GVListings.DataBind();
}


protected void btnSearch_Click(object sender, EventArgs e)
{
LPOBJ.L_CompanyName = txtCompanyName.Text.Trim();
GetData();
}
protected void GVListings_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
LPOBJ.L_YPID = (int)GVListings.DataKeys[e.RowIndex].Value;
int i = ABLOBJ.DeleteListings(LPOBJ, UPOBJ);
if (i > 0)
{
Result("Deleted Successfully");

}
else
{
Result("Some Problem has occured.");
}
LPOBJ.L_CompanyName = txtCompanyName.Text.Trim();
GetData();
}
protected void GVListings_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GVListings.PageIndex = e.NewPageIndex;
GVListings.DataSource = Session["Result"];
GVListings.DataBind();
}
public void Result(string resMsg)
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append("<script type = 'text/javascript'>");
sb.Append("window.onload=function(){");
sb.Append("alert('");
sb.Append(resMsg);
sb.Append("')};");
sb.Append("</script>");
Page.RegisterClientScriptBlock("send_mailss", sb.ToString());

}

protected void lnkCustDetails_Click(object sender, EventArgs e)
{


// Fetch the customer id
LinkButton lb = sender as LinkButton;
string custID = lb.Text;
LPOBJ.L_YPID = Convert.ToInt32(custID);
// Connection
lblCustValue.Text = custID;
// Show the modalpopupextender
ModalPopupExtender1.Show();
}

Regards,
Bhanu Prakash Bysani

Bhanubysani, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response