|
In the calnder control when I click on the last selected value for the 2nd time the value should be removed from the textbox. right now the value is not getting removed from the textbox.
Also when I click on calnder control for 2nd time, in the codebehind where I set the textbox value I can see the updated value been set to Textbox in the SelectedDates() event but that value is not reflected on the webpage.
This code for making Calender to work as multiple select. EX: select 3 values from the calender controls all those values will be displayed in the textbox, when u click on calender control and if the value already exits the value gets removed from the textbox.
Now the calender has 3 values and the default select on the calnder is the 3rd value. If the user clicks on the 3rd value again on the calnder control the value from the textbox is not removed whereas if clicks on one of the previos 2 values in the calender control that value gets removed and then if he clicks the 3rd value now it gets removed.
Whereas if we put the Calender control above textbox control and textbox has 3 values and now if u select 3rd value in the calnder, the value gets removed from the textbox.
Concern: How to remove the last selected value from the textbox when calnder control is placed below the textbox.
ASPX CODE:
-------------------------------------------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Width="427px"
/>
<asp:Calendar ID="Calendar1" runat="server" ondayrender="Calendar1_DayRender"
onselectionchanged="Calendar1_SelectionChanged"></asp:Calendar>
</div>
</form>
</body>
</html>
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{
public static List<DateTime> list = new List<DateTime>();
private bool calenderStatus = false;
public bool CalenderStatus
{
get { return calenderStatus; }
set { calenderStatus = value; }
}
protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
{
if (e.Day.IsSelected == true)
{
if (CalenderStatus == false)
SelectedDates();
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
SelectedDates();
}
private void SelectedDates()
{
CalenderStatus = true;
for (int i = 0; i < Calendar1.SelectedDates.Count; i++)
{
if (TextBox1.Text == "")
TextBox1.Text = Calendar1.SelectedDates[i].ToShortDateString();
else
{
if (TextBox1.Text.Contains(Calendar1.SelectedDates[i].ToShortDateString()))
{
TextBox1.Text = TextBox1.Text.Replace("," + Calendar1.SelectedDates[i].ToShortDateString(), "");
TextBox1.Text = TextBox1.Text.Replace(Calendar1.SelectedDates[i].ToShortDateString() + ",", "");
}
else
TextBox1.Text = TextBox1.Text + "," + Calendar1.SelectedDates[i].ToShortDateString();
}
}
}
}
}
modified on Friday, April 8, 2011 4:22 AM
|
|
|
|
|
Hello all,
I have a accordion control which I am using in my webform. No matter what I do, I cant make the accordion appear under my table.
It always appears top of the table(not inside) although in the design I placed the accordion inside the table's row.
I place the control inside a panel, update panel I cant get it to work. Any suggestions?
|
|
|
|
|
It's possible that your CSS is moving the accordion. To be honest, I shudder at concepts like this because it sounds like you're trying to control your layout with tables - you really should look into styling your page with CSS if possible.
|
|
|
|
|
Well it seems like when the page loads, it automatically places the accordion into a div. And div is in a seperate div which is different than the div where my table is. ( I dont know why it creates a new div and places it inside though. )
|
|
|
|
|
Hi all,
I have a web site name "http://servername". Now I have created another subsite under the root site ("http://servername/test").
Now I want access this sub site using some other url i.e. if user types a URL say "http://xyz.com" in browser then internally it should redirect to the sub site "http://servername/test" and show its data but URL in the browser should be shown as "http://xyz.com".
Please let me know if I can achieve it by doing some setting on IIS level or writing some custom code.
Thanks in advance,
Alok...
|
|
|
|
|
I think it will not going to work,
I means do you think it is possible 'http://servername' will redirect to other website?
but if you asking for like 'http://servername/somepages.aspx' too 'http://servername/somepage' then use URL Rewriting in ASP.NET.
|
|
|
|
|
Want call javascript function after complete some process in sever side. I tried this but not call function plz help me
Server side code:
string script = "<script type='text/javascript'>ShowValue();</script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowValue", script, true);
Client side Code:
<script type="text/javascript">
function ShowValue()
{
alert("called");
}
<Script>
|
|
|
|
|
Hi,
The code you have written is OK but one problem.
ScriptManager.RegisterStartupScript function's last parameter is a boolean value and it is used for mentioning whether "" tag need to be appened to the rendered script. In your code as you have appended <script> tag already, and while calling the ScriptManager.RegisterStartupScript function, 5th parameter you have mentioned as true, then in client side, system generates script tag twice and rendered. As a result the rendered code is here,
<pre>
<script type="text/javascript">
//<![CDATA[
<script language='javascript' type='text/javascript'>ShowValue();</script>//]]>
</script>
</pre>
As you see, it is wrong and if above code is rendered, then surely it gives error.
To correct it, you need to call ScriptManager.RegisterStartupScript with "false" value as the last parameter if from the code behind side you are appending the script tag.
<pre>
ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowValue", script, false);
</pre>
Hope that helps,
<div class="signature">Thanks,
Arindam D Tewary</div>
|
|
|
|
|
Hi all,
I'm new to ASP.NET. I have Visual Studio 2008 with .Net Framework 3.5 on my machine.
I have a project using System.Web.Extensions 3.6.0.0. I cannot run this project because I only have the version 3.5.0.0.
Can you please tell me where I can get System.Web.Extensions 3.6.0.0?
Thank you!
Here is a part of my web.config file:
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules runAllManagedModulesForAllRequests="true">
<remove name="ScriptModule"/>
<remove name="DynamicDataModule"/>
<remove name="UrlRoutingModule"/>
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="DynamicDataModule" preCondition="managedHandler" type="System.Web.DynamicData.DynamicDataHttpModule, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="UrlRoutingModule" type="System.Web.Mvc.UrlRoutingModule, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<remove name="ScriptHandlerFactory"/>
<remove name="ScriptHandlerFactoryAppServices"/>
<remove name="ScriptResource"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="MvcScriptMap" preCondition="classicMode" verb="*" path="*.mvc" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"/>
<add name="MvcHandler" preCondition="integratedMode" verb="*" path="Mvc.axd" type="System.Web.Mvc.MvcHandler, System.Web.Extensions, Version=3.6.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.5.0.0" newVersion="3.6.0.0"/>
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
<bindingRedirect oldVersion="1.0.0.0-3.5.0.0" newVersion="3.6.0.0"/>
</dependentAssembly>
</assemblyBinding>
</runtime>
|
|
|
|
|
|
Thanks for your reply. But I found no answer in that thread.
|
|
|
|
|
I was not very sure where to post this. Found aspx and httphandler related to asp.net so posted here.
I have used JQuery to call autocomplete on a textbox1 as below:
$("input#textbox1").autocomplete({
source: ["India", "Japan", "United Kingdom", "United States", "Australia", "France", "China"]
});
This works fine.
When i try to change this to
$("input#textbox1").autocomplete('GenericHandler.ashx');
, the 'GenericHandler.ashx' never gets called.
In ProcessRequest method of GenericHandler, i have written
context.Response.Write("India|Japan|United Kingdom|United States|Australia|France|China");
I have included appropriate verb in web.config for caller.
How do i achieve the autocomplete calling ashx and then getting data to fill ?
Please help.
note: I am using jquery-ui.min.js for AutoComplete.
|
|
|
|
|
hi RaviSant,
As far as i know,
u can use JSON format to return ur result from ashx file.
and in the .autocomplete use options as parameter.
like this.
var options, a;
jQuery(function(){
options = { serviceUrl:'GenericHandler.ashx' };
a = $('#query').autocomplete(options);
});
and in the web service class, return the JSON format like this.
{
query:'Li',
suggestions:['India', 'Japan', 'United Kingdom', 'United States', 'Australia', 'France', 'China'],
data:['IN','JP','UK','US','AZ','FR','CH']
}
query is the entered search key
suggestions is the list to display in dropdown
data is optional to use as value field when u select suggestion data from dropdown text
To know more about JSON,here[^]
To learn how to return JSON format from ashx , here[^]
Ref: I get this code from devbridge.com[^]
Hope this works!
Please give any idea or suggestion on my advice.
|
|
|
|
|
First, the company prefers classic asp rather than asp.net. So, apologies to the .net gurus out there.
I've tried isolating various parts of this code and can't figure out why this returns the first record multiple times. Like, it's not moving to the next record in the recordset.
Dim ID2, RefDoc, RefRev, RefNotes, strSQL3
Set objCon = Server.CreateObject ("ADODB.Connection")
Set objRec = Server.CreateObject ("ADODB.Recordset")
strSQL3 = "SELECT * FROM UMIDRefDocs WHERE CardNo ='" & CardNo & "'"
objCon.Open strCon
objRec.Open strSQL3, objCon
If objRec.EOF = true then
Response.Write("<tr><td colspan=3>No reference documents exist for this card.</td></tr>")
End If
If Not objRec.EOF and not objRec.BOF then
ID2 = objRec("ID")
RefDoc = objRec("RefDoc")
RefRev = objRec("RefRev")
RefNotes = objRec("RefNotes")
Do Until objRec.EOF
Response.Write("<tr><td><a href='do_UMID_EditRefDocs.asp?RefDoc=" & RefDoc & "&Action=Delete&CardNo=" & CardNo & "'><img src='images/delete.gif' alt='Delete' border='0'></a>")
Response.Write("  <a href='UMID_RefDocs.asp?CardNo=" & CardNo & "&RefDoc=" & RefDoc & "&Action=Edit'><img src='images/edit.gif' alt='Edit' border='0'></a>  " & RefDoc & " </td>")
Response.Write("<td>" & RefRev & " </td>")
Response.Write("<td>" & RefNotes & " </td></tr>")
objRec.MoveNext
Loop
End If
objRec.Close
objCon.Close
Set objRec = Nothing
Set objCon = Nothing
I've used this same pattern in other pages: Define the SQL string, open the recordset, write the table row for the current record, MoveNext, Loop, close the connection. But this time, for the given recordset I'm looking at, there are two records; I only get the first one repeated twice.
Any ideas?
----------------------------------
I'm not a programmer by trade, so please don't beat me unmerciful.
|
|
|
|
|
Bomb_shell wrote: ID2 = objRec("ID") RefDoc = objRec("RefDoc") RefRev = objRec("RefRev") RefNotes = objRec("RefNotes")
These statemens are outside your loop, no wonder you see the same data over and over.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
hi Bomb_shell,
As far as i know, in your problem, u assign the variable with first record and
never assign it again when u loop and print out.
So, as a suggestion, I re-order ur code.
(I don't know much about VB )
If objRec.EOF = true then
Response.Write("<tr><td colspan=3>No reference documents exist for this card.</td></tr>")
Else
Do Until objRec.EOF
ID2 = objRec("ID")
RefDoc = objRec("RefDoc")
RefRev = objRec("RefRev")
RefNotes = objRec("RefNotes")
Response.Write("<tr><td><a href='do_UMID_EditRefDocs.asp?RefDoc=" & RefDoc & "&Action=Delete&CardNo=" & CardNo & "'><img src='images/delete.gif' alt='Delete' border='0'></a>")
Response.Write("  <a href='UMID_RefDocs.asp?CardNo=" & CardNo & "&RefDoc=" & RefDoc & "&Action=Edit'><img src='images/edit.gif' alt='Edit' border='0'></a>  " & RefDoc & " </td>")
Response.Write("<td>" & RefRev & " </td>")
Response.Write("<td>" & RefNotes & " </td></tr>")
objRec.MoveNext
Loop
End If
Hope it works!
|
|
|
|
|
its simple. it doesn't move because it is outside the loop.
it should
Do Until objRec.EOF
ID2 = objRec!ID
objRec.MoveNext
Loop
C# コードMicrosoft End User
2000-2008
「「「「「「「「「「「「「「「「「「「「「「「「「「「「
The best things in life are free
」」」」」」」」」」」」」」」」」」」」」」」」」」」」
|
|
|
|
|
wow.. people still do plain asp/vbs?
|
|
|
|
|
Thanks, y'all. That was so dumb, I didn't even think of that. But it worked and I'm good now.
HaBiX wrote: wow.. people still do plain asp/vbs?
It's a company limitation, but I'm a noob, so I don't mind learning it old school before I learn the "real" way.
----------------------------------
I'm not a programmer by trade, so please don't beat me unmerciful.
|
|
|
|
|
Hi all,
I am new to AJAX. I have one ajax tab container and two tabs in it. In each tab I have gridview to show the data. The colums are same in both of the gridviews. So I was wondering whelther we can use just one gridview and use in both tabs like reusuable grid view. But I don't know how to do that. CCan anyone please refer me to the links having those kinds of examples ?
Thanks in advance,
suchita
|
|
|
|
|
Sir;
I don't think that you need a tab container, all you need is two spans with the attribute onclick set to GetPostbackEventReference() (or any thing can cause potback) , a div, and an update panel cotaning the grid.
so you can update the grid content every postback.
Good Louk
Help people,so poeple can help you.
|
|
|
|
|
Actually I need to show in the tab forms.. So I have multiple tabs in that page.
suchita
|
|
|
|
|
TabContainer is rendered somthing like
<span>Tab1</span>
<span>Tab2</span>
<div>Div1</div>
<div>Div2</div>
when you click a span (or tab header) the display of the assosiated div (tab body) is toggled to block and the other to none.
what i want you to do is drawing something that looks like a tab container with one div and no display toggling just like
<span>Tab1</span>
<span>Tab2</span>
<div>Div1
<asp:updatepanel ID="updatepanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" />
</ContentTemplate>
</ asp:updatepanel>
</div>
you can also use a tab container, but you will need to add the grid dynamically in the code (server side).
100
Help people,so poeple can help you.
|
|
|
|
|
HI all,
I am creating a webapplication in c#.net.In this apllication i am displaying files from the server.
Now what i want to do is , i want to download the selected file.
How can i do this ?
Thanks in advance.
|
|
|
|
|
This may help you. May be you need to tweak the code little bit. Give a try
Success is the good fortune that comes from aspiration, desperation, perspiration and inspiration.
|
|
|
|
|