|
Hi all,
I am building one application where i want to do folowing
1) Open popup on button click
2) Pop up contains name textbox and search button and datagrid.
3) user type name in textbox and search result will comre in datagrid
I used modal popup ajax control (AnimationExtender)
New pop is properly loding with all controls but when i clicked on search button popup window automaticaly close.
I am not getting how to handel this?
so plz help me if anyone knows soln....
|
|
|
|
|
Hi,
You can put two button(Search N Close) one for search and another for closing popup
use UpdatePanel put both buttons in this and call .Hide() method of ModelPopup in code behind on button
click event.
see the sample impl.
.aspx coding
<asp:button runat="server" id="hiddenTargetControlForModalPopup" style="display: none">
<cc1:modalpopupextender runat="server" id="programmaticModalPopup" behaviorid="programmaticModalPopupBehavior">
TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="programmaticPopup"
BackgroundCssClass="modalBackground" DropShadow="false" PopupDragHandleControlID="programmaticPopupDragHandle"
RepositionMode="RepositionOnWindowScroll">
<asp:panel runat="server" cssclass="modalPopup" id="programmaticPopup" style="display: none">
<asp:panel runat="server" id="programmaticPopupDragHandle">
<asp:label id="lblHeading" runat="server" text="Do you want to continue merging process?">
<asp:label id="lblMergeConfirm" runat="server">
<asp:updatepanel id="upnlModal" runat="server">
<asp:button id="btnOk" runat="server" text="Yes" cssclass="defaultButton" causesvalidation="false">
<asp:button id="btnClose" runat="server" text="Close" cssclass="defaultButton" causesvalidation="false">
Implement your logic for populating Gridview with appropriate search results in Search Button click event in code behind..
Protected Sub btnClose_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnClose.Click
Try
Me.programmaticModalPopup.Hide()
Catch ex As Exception
throw ex
End Try
End Sub
Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnOk.Click
Try
// implement logic to populate gridview with resultset.
// If you want to execute any logic when click on button that opens popup
// you put button ouside the updatepanel.
Catch ex As Exception
throw
End Try
End Sub
Check lines which are in bold format. I hope this will solve your problem.
if you get any problem in populating GridView then pls delete search button from updatepanel.
You can refer Ajaxtoolkit sample impl video for all ajaxtoolkit controls.
modified on Wednesday, May 28, 2008 10:21 AM
|
|
|
|
|
Hi all,
i used have this function for validate new user:
public bool ValidateNewUser(string strAlias, string strFirst, string strLast)
{
SqlConnection MyConn = new SqlConnection(ConfigurationSettings.AppSettings["MyOnlineShoppingConnectionString2"]);
SqlCommand MyCmd = new SqlCommand("sp_CheckForDuplicates", MyConn);
MyCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter objParam3;
SqlParameter objReturnParam;
objParam1 = MyCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar);
objParam3 = MyCmd.Parameters.Add("@LastName", SqlDbType.VarChar);
objReturnParam = MyCmd.Parameters.Add("@Duplicates", SqlDbType.Int);
objReturnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = strAlias;
objParam2.Value = strFirst;
objParam3.Value = strLast;
try
{
if (MyConn.State == ConnectionState.Closed)
{
MyConn.Open();
MyCmd.ExecuteNonQuery();
}
<big>if (objReturnParam.Value > 0)</big>
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
else
{
return true;
}
MyConn.Close();
}
catch (Exception ex)
{
lblError.Text = "Error Connecting to Database!";
}
}
but when i run this code this error is occured:
Operator '>' cannot to operands of type 'Object' and 'Int'
how i can resolve this error?
thank you,
Hoda
|
|
|
|
|
sorry for duplicating this massage,but i couldn't delete one of them.
Hoda
|
|
|
|
|
Saba02 wrote: i couldn't delete one of them.
Are you facing a specific error? Perhaps you can try posting a request for the same in 'Suggestions' forum so that a CP Administrator should help you with the same.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Hi There
If i understand your question very well ....
i think you should use
if (Convert.ToInt32(objReturnParam.Value) > 0)
try it
|
|
|
|
|
|
Hi all,
i used have this function for validate new user:
public bool ValidateNewUser(string strAlias, string strFirst, string strLast)
{
SqlConnection MyConn = new SqlConnection(ConfigurationSettings.AppSettings["MyOnlineShoppingConnectionString2"]);
SqlCommand MyCmd = new SqlCommand("sp_CheckForDuplicates", MyConn);
MyCmd.CommandType = CommandType.StoredProcedure;
SqlParameter objParam1;
SqlParameter objParam2;
SqlParameter objParam3;
SqlParameter objReturnParam;
objParam1 = MyCmd.Parameters.Add("@UserName", SqlDbType.VarChar);
objParam2 = MyCmd.Parameters.Add("@FirstName", SqlDbType.VarChar);
objParam3 = MyCmd.Parameters.Add("@LastName", SqlDbType.VarChar);
objReturnParam = MyCmd.Parameters.Add("@Duplicates", SqlDbType.Int);
objReturnParam.Direction = ParameterDirection.ReturnValue;
objParam1.Value = strAlias;
objParam2.Value = strFirst;
objParam3.Value = strLast;
try
{
if (MyConn.State == ConnectionState.Closed)
{
MyConn.Open();
MyCmd.ExecuteNonQuery();
}
if (objReturnParam.Value > 0)
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
else
{
return true;
}
MyConn.Close();
}
catch (Exception ex)
{
lblError.Text = "Error Connecting to Database!";
}
}
but when i run this code this error is occured:
Operator '>' cannot to operands of type 'Object' and 'Int'
how i can resolve this error?
thank you,
Hoda
|
|
|
|
|
You might need to convert objReturnParam to an integer
|
|
|
|
|
Saba02 wrote: objReturnParam.Value
Can you pass this to Convert.ToInt32() ?
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
Saba02 wrote: if (objReturnParam.Value > 0)
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
You need to convert the parameter value to integer.
if (Convert.ToInt32(objReturnParam.Value) > 0)
{
lblResult.Text = "UserName already exists or you are already a registered user!";
return false;
}
|
|
|
|
|
Thank you for your responses
Hoda
|
|
|
|
|
I have put on some controls on page and i am using AJAX...
<code><table id="TABLE1" style="width: 100%">
<tr>
<td>
Item</td>
<td colspan="4">
<asp:dropdownlist id="DDL_Item" runat="server" datasourceid="Itemsource" datatextfield="description" datavaluefield="code">
</asp:dropdownlist>
<asp:sqldatasource id="Itemsource" runat="server" connectionstring=""><![CDATA[<%$ ConnectionStrings:Conn %>]]>"
SelectCommand="Fill_Price_Item_Dropdown" SelectCommandType="StoredProcedure"></asp:sqldatasource>
</td>
</tr>
<tr>
<td>
Date From:</td>
<td>
<table>
<tr>
<td><asp:textbox id="TextBox_Date_From" runat="server"></asp:textbox></td>
<td>
<img id="Btn1" src="../images/CalImage.gif" /></td>
</tr>
</table>
<cc1:calendarextender id="CalendarExtender1" runat="server" format="dd/MM/yyyy" popupbuttonid="Btn1">
targetcontrolid="TextBox_Date_From"></cc1:calendarextender>
</td>
<td>
</td>
<td>
To</td>
<td>
<table>
<tr>
<td>
<asp:textbox id="TextBox_Date_To" runat="server"></asp:textbox></td>
<td>
<img id="Btn2" src="../images/CalImage.gif" /></td>
</tr>
</table>
<cc1:calendarextender id="CalendarExtender2" runat="server" format="dd/MM/yyyy" popupbuttonid="Btn2">
targetcontrolid="TextBox_Date_To">
</cc1:calendarextender>
</td>
</tr>
<tr>
<td>
Zone</td>
<td colspan="4">
<asp:updatepanel id="UpdatePanel1" runat="server">
<contenttemplate>
<asp:dropdownlist id="DDL_Zone" runat="server" datasourceid="Zone_src" datatextfield="Zone_Name" datavaluefield="Zone_Code" autopostback="True" onselectedindexchanged="DDL_Zone_SelectedIndexChanged">
</asp:dropdownlist><asp:sqldatasource id="Zone_src" runat="server" connectionstring=""><![CDATA[<%$ ConnectionStrings:Conn %>]]>"
SelectCommand="SELECT DISTINCT [Zone_Code], [Zone_Name] FROM [Zone_Master] WHERE ([isdeleted] = 0)">
<selectparameters>
<asp:parameter defaultvalue="0" name="isdeleted" type="Int32" />
</selectparameters>
</asp:sqldatasource>
</contenttemplate>
</asp:updatepanel>
</td>
</tr>
<tr>
<td>
State</td>
<td colspan="4">
<asp:updatepanel id="UpdatePanel2" runat="server">
<contenttemplate>
<asp:dropdownlist id="DDL_State" runat="server" datasourceid="State_src" datatextfield="State_Name" datavaluefield="State_Code">
</asp:dropdownlist>
<asp:sqldatasource id="State_src" runat="server" connectionstring=""><![CDATA[<%$ ConnectionStrings:Conn %>]]>"
SelectCommand="SELECT [State_Code], [State_Name] FROM [State_Master] WHERE ([Zone_Code] = @Zone_Code)">
<selectparameters>
<asp:controlparameter controlid="DDL_Zone" defaultvalue="0" name="Zone_Code" propertyname="SelectedValue">
Type="String" />
</asp:controlparameter></selectparameters>
</asp:sqldatasource>
</contenttemplate>
<triggers>
<asp:asyncpostbacktrigger controlid="DDL_Zone" eventname="SelectedIndexChanged" />
</triggers>
</asp:updatepanel>
</td>
</tr>
<tr>
<td>
</td>
<td align="center" colspan="4">
<asp:button id="Button_Search" runat="server" text="Search" width="83px" /></td>
</tr>
</table></code>
on page load i m setting the default select option as follows..
<code><pre> Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
DDL_Item.DataBind()
DDL_Zone.DataBind()
DDL_State.DataBind()
DDL_Item.Items.Insert(0, New ListItem("Select", "0"))
DDL_Zone.Items.Insert(0, New ListItem("Select", "0"))
DDL_State.Items.Insert(0, New ListItem("Select", "0"))
TextBox_Date_From.Text = Now.Date.ToString("dd/MM/yyyy")
TextBox_Date_To.Text = Now.Date.ToString("dd/MM/yyyy")
TextBox_Date_From.Attributes.Add("readonly", "readonly")
TextBox_Date_To.Attributes.Add("readonly", "readonly")
End If
End Sub</pre></code>
but i m unable to set the "Select" option for zone ddl. I mean that the option is present in the DDL but the second option is highlited always...
I also tried this
DDL_Zone.Items.FindByValue("0").Selected = True
but it didn`t help... what can be that prob
|
|
|
|
|
try this
DDL_Zone.Items.SelectedValue = "0" or
DDL_Zone.SelectedValue = DDL_Zone.Items.FindByText("0").Value
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
Do you mean that when someone clicks on the dropdownlist the select is not highlighted first or do you mean when someone clicks on the select value and then leaves the dropdown it doesnt store the select value?
|
|
|
|
|
What are you doing in the DDL_Zone_SelectedIndexChanged method? Any rebinding to the dropdown?
*jaans
|
|
|
|
|
Dear All,
In one of my application I have a main report and many sub-reports are linked to it.
As we know we can;t have a page header and footer.
So I thought of having 2 page headers in the main report and suppressing it is the first report and not in others.
Now I don't know how to get the sub report name in order to specify it in the suppressing criteria.
Can any one help in this regard?
Thanks a lot in advance.
Best Regards,
M. J. Jaya Chitra
|
|
|
|
|
In the internet explorer , how should I delete all the addresses in the address drop down list.
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
You mean deleting browsing history of IE?
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
|
|
|
|
|
yes
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
I'm not sure how this is related to asp.net but never mind
you need to delete your cache, something like tools - internet options and you will find it there
|
|
|
|
|
how should i do it programatically
If you have an apple & I have an apple and we exchange our apples, then each of us will still have only one apple but if you have an idea & I have an idea and we exchange our ideas, then each of us will have two ideas!
|
|
|
|
|
check this out;
http://forums.asp.net/p/1118810/1741268.aspx
|
|
|
|
|
You can't do that using ASP.NET. You would need the user to download an application and start it on the client computer.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
I am using a grid view.In that grid view there is a template field which contains a checkbox.And there is a external button which used to insert the selected values to databse. Im using paging in grid view.My problem is when i select values of multiple pages,only current pages values is taking.Other clicks are not taking.If i ckick two values out of 10 of first page and went to second page which contains 4 values and clicket one value.Then clicking the save button.Then only values in second page is getting saved.What should i do.I used session for keeping checking even in paging.
Can any one help??
|
|
|
|