|
You're right, this code requires to be in your page class / codebehind.
If you are trying to show a messagebox within your business logic or data layer (other class/ assembly),you should rethink that.
Try to develope your business layer as unaware of your UI as possible. Therefore, don't
show a messagebox within that BL-Class, just "raise an event" or somehow inform an interested caller about the exception (for example the page which then displays the messagebox).
I'll explain that later if necessary, as i have to go home now unfortunately:/
|
|
|
|
|
You can do it using Page.ClientScript.RegisterStartupScript .
Like :
String alertScript = "<script language='javascript'>alert('" & strMsg & "')</script>"
Page.ClientScript.RegisterStartupScript(GetType(Page), "PopupScript", alertScript)
You may also have look into this :
ASP.NET Alerts: how to display message boxes from server-side code?[^]
|
|
|
|
|
Hi,
I create a gridview which with product name and sold count in 14 regions, I put the 14 region header text in vertical orientation to fit the region text.
I put the gridview in a panel like the following, when product list is longer, the vertical scroll appear.
<asp:panel id="Panel1" runat="server" height="690px" width="100%" scrollbars="Vertical">
<gridview id="GridView1">
Everything is fine if I resize the window, the header width and gridview width are resized.
The problem is that if I want to fixed the header by using the following css:
.header1{
height:20px;
padding: 0px;
font-weight:bold;
position: absolute;
background-color:Whte;
margin-top:-3px;
margin-left:0px;
}
And add the <headerstyle cssclass="header1"> for between <gridview> tag, the header is fixed, but if I change the window size, the header size won't change, only girdview width change, this makes the fixed header is longer than girdview.
How can I solve this problem?
Thanks a lot.
|
|
|
|
|
When i save data Present in the textboxes i want to clear the textbox without writing server side code.
I think it is possible if i make
<asp:Textbox EnableViewState="false" />
But it not working.....Why?
Thanking you in advance.........
|
|
|
|
|
Try this:
<asp:Textbox Text="" EnableViewState="false" />
|
|
|
|
|
Not Working.....Thanks for reply
|
|
|
|
|
How are you saving the data? How is the data getting in the textbox in the first place? If the textbox starts off empty and the user enters the data, you click a button to save and the page reloads you could put some javascript at the bottom of the page to blank it out on client page load.
<asp:TextBox ID="txtThing" runat="server">
<script type="text/javascript">
document.getElementByID('<%=txtThing.ClientID%>').value='';
</script>
|
|
|
|
|
Hey actually i m using a user control and add this controls in it. However how i detect the user control reloads?........
|
|
|
|
|
It may be browser's 'autocomplete' feature filling it in.
You can switch it off by using:
<asp:TextBox Runat="server" ID="Textbox1" autocomplete="off" EnableViewState="false"></asp:TextBox>
|
|
|
|
|
Not Working............
|
|
|
|
|
No, disabling ViewState would not make the text go.
As far as I know, text property of a TextBox is preserved using ControlState and we do not have control over it.
Sandesh M Patil wrote: When i save data Present in the textboxes i want to clear the textbox
You must be posting the values to the server to save the data. After you save it add a line:
txtTextBoxName.Text = "";
I hope this helps!
..Go Green..
|
|
|
|
|
Hi,
I have a GridView control which is currently bound to an object which contains a DateTime property, "Survey Date". As the GridView width is limited, I want to display a checkbox instead of a DateTime to indicate that the survey has taken place. The survey is deemed to have taken place if a value has been entered for the survey date/time.
I can't bind a checkbox property using the DateTime in the GridView row can I? Somehow I'd have to check the DateTime object and if valid, set the checkbox to true and false otherwise.
Any ideas welcome!
|
|
|
|
|
Bind Your check box like this
<ASP:CkeckBOx ID="Chk1" runat="server" Checked='<%#Convert.ToDateTime(Eval("Surve_Date", "{0:dd/MM/yyyy}").ToString() == "01/01/0001" ? false: true) %>' />
|
|
|
|
|
Thanks, I made a minor change to remove the ConvertToDateTime() call and it works just fine
|
|
|
|
|
I have 12 textboxes controls and 5 dropdown lists in web page. I want to assign a common style to textboxes and common style to dropdown lists.
I dont want to assign a class to each <asp:textbox> control
wheather i can do this
TextBox
{
font-family:Verdana;
font:30px;
font-weight:normal;
}
however this is not working..
Please Suggest......
|
|
|
|
|
Can you provide a bit code to understand the problem ?
The CSS and which property of textbox you used to assign the css class. (To understand why it fails)
Jinal Desai - LIVE
Experience is mother of sage....
|
|
|
|
|
WebPage.aspx
<table cellpadding="2" cellspacing="0" border="0" width="50%">
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2" class="UserHeading">Enter User Information</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><label id="lblUserName" runat="server">User Name</label></td>
<td><asp:TextBox ID="txtUserName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><label id="lblPassword" runat="server">Password :</label></td>
<td><asp:TextBox ID="txtPassword" TextMode="Password" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><label id="Label1" runat="server">Email Id :</label></td>
<td><asp:TextBox ID="txtEmailId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><label id="Label2" runat="server">Address :</label></td>
<td><asp:TextBox ID="txtAddress" runat="server" TextMode="MultiLine"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td><label id="Label3" runat="server">Contact No :</label></td>
<td><asp:TextBox ID="txtContactNo" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><asp:Button ID="btnSave" runat="server" Text="Save" /></td>
</tr>
</table>
stylesheet.css
.UserHeading
{
font-family:Calibri;
font-size:20px;
font-weight:bold;
}
TextBox
{
font-family:Verdana;
font:30px;
font-weight:bold;
}
label
{
font-family:Verdana;
font:11px;
font-weight:normal;
}
label style applies to all labels. Similarly i want to apply to <asp:textboxes>
Please Suggest.........
|
|
|
|
|
try in this format
apply class to table
.table td input
{
font-family:Verdana; font:30px; font-weight:bold;
}
|
|
|
|
|
Thanks........ It works but it doesnot apply to Multiline Textbox id="txtAddress"........
|
|
|
|
|
Multiline textbox doesnot render as input. It gets rendered as TextArea, so provide css for TextArea then it will work
|
|
|
|
|
Thanks............
|
|
|
|
|
your welcome
|
|
|
|
|
i am using masked edit extender and modal pop up extender controls .it wrks fine . now i need use a user control in the same page. the problem is ,after i added user control , the ajax extender controls doesn't work .however no error occurs when i browse the page.
please anybody help me .
|
|
|
|
|
This shouldnt be a problem. Can you post the code of your page maybe? Exclude unnecessary parts.
Maybe there is some mixup with the tagnames/tagprefixes in the registration part of this controls
in your page?
|
|
|
|
|
Hi all
Im using multi select drop down list from following link..
multiselectdropdown
It is working fine locally. But in remote server getting javascript error when i try to select list items....
Help me...
|
|
|
|