|
use ispostback(), and populate your asp labels if only is not a postback to the server. If you really wants to use server methods from java script or you want to save the data from java sctipt to database, you can use AJAX.
|
|
|
|
|
What AJAX control would I use?
|
|
|
|
|
you know that,
When page loads the code behind queries the database and populates some asp labels.
and you are right,
when the page reloads before the click event code runs the new values of the labels are replaced with original values from the server.
So populate some asp labels in page_load if and if only is not a page postback.
like,
if(!ispostback)
{
//populate some asp labels
}
hope it helps
|
|
|
|
|
Respected Sir
I need help by u To Get AM and P.M is extension of this control i wrote code like this i devoluped one webuser control i need am and pm to this control plese send me code i wrote like below
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Time.ascx.cs" Inherits="dotnetcode_UserControls_Time" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>
<%@ Register Assembly="Validators" Namespace="Sample.Web.UI.Compatibility" TagPrefix="cc2" %>
<%@ Import Namespace="System.Threading" %>
<asp:TextBox ID="TxtTime" runat="server" Width="40px" Height="16px" />
<cc2:RequiredFieldValidator ID="Rfv" runat="server" ControlToValidate="TxtTime" Display="None"
ErrorMessage="<b>This Field Is Required</b><br />Enter Data Is Must" Font-Bold="False"
Font-Italic="False" Font-Names="Verdana" Font-Overline="False" Font-Size="Smaller"
Font-Strikeout="False" Font-Underline="False" SetFocusOnError="True" ToolTip="Field is Required"></cc2:RequiredFieldValidator>
<ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender3" runat="server"
TargetControlID="TxtTime"
Mask="99:99"
MessageValidatorTip="true"
OnFocusCssClass="MaskedEditFocus"
OnInvalidCssClass="MaskedEditError"
MaskType="Time"
ErrorTooltipEnabled="True" /><%--AcceptAMPM="True"--%>
<ajaxToolkit:MaskedEditValidator ID="MaskedEditValidator3" runat="server"
ControlExtender="MaskedEditExtender3"
ControlToValidate="TxtTime"
IsValidEmpty="False"
EmptyValueMessage="Time is required"
InvalidValueMessage="Time is invalid"
Display="Dynamic"
TooltipMessage="Input a time"
EmptyValueBlurredText="*"
InvalidValueBlurredMessage="*"
/>
<ajaxToolkit:ValidatorCalloutExtender ID="VceRfv" runat="server" TargetControlID="Rfv">
</ajaxToolkit:ValidatorCalloutExtender>
|
|
|
|
|
<cc1:maskededitvalidator id="MaskedEditValidator1" runat="server"
="" controlextender="MaskedEditExtender1" controltovalidate="txtTime" display="None" invalidvaluemessage="Invalid Time">
<cc1:maskededitextender id="MaskedEditExtender1" runat="server" mask="99:99" masktype="Time" targetcontrolid="txtTime" <big="">AcceptAMPM="true">
Padmanabhan
|
|
|
|
|
I want to make an inbox page in which i have a checkbox column in gridview.I have bind all needed values.this page has a delete button.when it clicks all checked message are deleted.here is code i had tried but it didn't work.I think it is not recognized checkbox checked state.
protected void Page_Load(object sender, EventArgs e)
{
query="select brok.*,cust.FirstName+' '+cust.LastName as Name from brokermsgrecieved as brok,custdetails as cust where brok.BrokerId='"+Session["broker"]+"' and cust.CustId=brok.FromCustId";
dt = obj.select(query);
GridView1.DataSource=dt;
GridView1.DataBind();
}
protected void Button1_Click(object sender, EventArgs e)
{
int count =GridView1.Rows.Count;
for (int i = 0; i < count; i++)
{
CheckBox chk =(CheckBox)GridView1.Rows[i].FindControl("checkbox1");
if (chk.Checked)
{
query = "delete from brokermsgrecieved where MsgId='"+id+"'";
obj.delete(query);
}
}
}
|
|
|
|
|
In your case the gridview is getting binded on every post back. That is why you are loosing the value. Put the code in page load under (!Page.IsPostBack).
Apurva Kaushal
|
|
|
|
|
jainiraj wrote: query = "delete from brokermsgrecieved where MsgId='"+id+"'";
what is id here ? I dont see in the code. Do you update it ?
|
|
|
|
|
Hi All
I Have One Doubt i am using TabContainer with in that i took 3
tabpanel out side of Tabcontainer I Have Save Button I need To
Replace The Save Button Name As Next And when Final TabPanel
Using I need to get save button please send me code for this
|
|
|
|
|
Hi,
I have created an Master Page that resides within my root folder. I wanted to resuse this Master Page across various applications hosted in IIS. But in doing so I get the below [1] error. I googled and found following link
http://weblogs.asp.net/dwahlin/archive/2005/11/16/430779.aspx
To be more specific here is what I wanted to achieve
I have a master page @ following location
C:\Inetpub\wwwroot\Common\TemplateMaster.master
I wanted to use this master page across various applications
i.e. I wanted this master page to be used by various .aspx pages of my below applications
C:\Inetpub\wwwroot\SampleApp1\Page1.aspx
C:\Inetpub\wwwroot\SampleApp2\Page1.aspx
Following is the code for Master Page implementation within the C:\Inetpub\wwwroot\SampleApp1\Page1.aspx web page
<%@ Page Language="C#" MasterPageFile="/intranet/Common/TemplateMaster.master" CodeFile="Page1.aspx.cs" Inherits="Page1" Title="Page 1" %>
Now after the above implementation, when I try to build my SampleApp1 website, I encounter below [1] error
Is it possible to achieve this? If yes, then is there is any better way to achieve the above functionalities other than that shown in the above link?
[1]The virtual path '/intranet/Common/TemplateMaster.master' maps to another application, which is not allowed.
Regards,
Vipul Mehta
modified on Wednesday, May 27, 2009 11:03 PM
|
|
|
|
|
|
I could find many alternates are available to share a master page across various applications like, Using Version control system, Share it in a DLL... Google it you will get more.
|
|
|
|
|
Hi All,
Is there any posibility to assign controltovalidate as label
for any of the validation controls
and
also i want a required field validator with label can it be possible or not?
i tried to make use of controltovalidate as label but i got an error as
control to validate is required........
Regards,
Koti
|
|
|
|
|
Why would you need to validate a label control? It's just there to display text (an do other events, but still). I don't think you can use the validator control to validate static controls like that(image control, label, ect.)
Can you explain a little more about why you need to validate your label?
|
|
|
|
|
why i need to validate label is
i have a calender control(ajax) and textbox(asp.net)
i was performed required field validation on textbox bec it is must and
should for me, and it allow me to edit the textbox date,
but i dont want to edit textbox..
i know the other way to keep this as readonly
finally
i dont want to show the layout of textbox so i need a label
and there must be data in label at runtime i.,e required field it is
|
|
|
|
|
So you have a textbox to edit the date value of your calender control, but you don't want to use the textbox to edit?
There's no way to use a label in they way your trying. Validation controls only work on input controls, which a label is not. Why dont you change the style of the textbox to seem like a label?
|
|
|
|
|
Hi
Thanks alot for your suggestion
The way ur are dealing is supurb.
|
|
|
|
|
hiii,
I am having a gridview with checkbox
and now i want the count of the no.of chechkboxes checked.
when the checkbox is checked then it must show the count as 1
with out any button event i have to get the count immediately after
checking the checkbox.
plz tell me how i can do this....
Thanks in advance
|
|
|
|
|
//write this is check box CheckBox1_CheckedChanged
//aspx
AutoPostBack="True" OnCheckedChanged="CheckBox1_CheckedChanged1"
//aspx.cs
protected void CheckBox1_CheckedChanged1(object sender, EventArgs e)
{
int count = 0;
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow rows = GridView1.Rows[i];
bool ischeck = ((CheckBox)rows.FindControl("CheckBox1")).Checked;
if (ischeck)
{
count = count+1;
}
}
}
Padmanabhan
|
|
|
|
|
Thank you...
your code works...
but the thing i need is after checking the checkbox immediately without
clicking any button i have to get the count.
plz help me in doing this
Thanks in advance
|
|
|
|
|
ya this code will give the count as soon as you check the checkbox....
i have written the code in "CheckBox1_CheckedChanged1"
Padmanabhan
|
|
|
|
|
hi....
Thank you for helping me..
yah i too got the count but i am getting the count after clicking
the button submit in my page.
I wrote the code in Checkbox1_ChechedChanged.
I took the count into the label.
plz tell me where i am missing...
Thanks in advance
|
|
|
|
|
ya you miss AutoPostBack="True"
if you give AutoPostBack="True" only it will fire the Checkbox1_ChechedChanged event.
Padmanabhan
|
|
|
|
|
hi,
I done all the things guided by you.
But i am unable to get the count after immedialtely checking the
chechbox.
Is there any alternate i tried alot but failed.
its very urgent for me.
plz help me.
Thanks in advance
|
|
|
|
|
Search it as "Bubble event".
|
|
|
|