|
There are Two ways
1. Using Classic Asp Tag to fetch the Session Variable
var cal = <%= Session("LoginID") %>
2. You can make a AJAX call to server to fetch the Value stored in Session Variable
|
|
|
|
|
Try this -
var lgnId= '<%=Session["LoginId"]%>'
|
|
|
|
|
no,no,no,no.......
I have seen this code in a couple of dozen posts and it NEVER works.
My situation
ASP .NET 3.5
C# code doc.aspx.cs
...
...
Session["UID"] = "1234";
Javascript doc.aspx
var uid = <%=Session("IUD")%> NO
var uid = '<%=Session("IUD")%>' NO
var uid = "<%=Session("IUD")%> NO
var uid = <%=Session([IUD"]%> NO
var uid = '<%=Session["IUD"]%>' NO
var uid = "<%=Session["IUD"]%>" NO
I think the code below would work but I'm not sure how to code the client side
C# code
HiddenField hUID.value = Session["UID"];
Javascript
????????????????
I'm pretty frustrated after several hours of trying to get this to work. A working example of code would be HIGHLY appreciated.
Thanks,
Joe B
|
|
|
|
|
I want to hide the cursor or make the blinking cursor stop blinking in the asp.net textbox. Is that possible??
|
|
|
|
|
You cannot hide the cursor. If you have set the ReadOnly=True then it will not not let user write anything. But cursor blinking will appear by default. Alternatively you can set the property TabStop=False. Then cursor will not appear by default in Rich text Box. But if you click in the Rich Text Box the cursor wil blink. But it will not let user edit as you have set ReadOnly=True
|
|
|
|
|
no normal HTML input text cant do. Well, why not u use Span to do that, when user types in the document, just update the span. This way you can only do this, but I dont think it is a better option to do.
Otherwise you can hide cursor if the textbox is within a Flash object.
|
|
|
|
|
Hello,
I am having two textboxe's i.e Credit and Debit.
I want to validate the textbox so that only must be entered i.e either
credit or debit.
If the both the textboxe's are filled it must raise a validation
that only must be filled.
plz help me how to validate these textboxe's
Thanks in advance
|
|
|
|
|
Hi,
u can do from client side,
function fnnotnull()
{
if ((document.GetelementId("<%= txtCredit.ClientID %>").value <> "") && (document.GetelementId("<%= txtdebit.ClientID %>").value <> ""))
{
alert("Msg here");
return false;
}
}
u can call this in a button onclientclick event
regards,
kannak....
kannak
|
|
|
|
|
I guess, you directly write the code over here
Small Correction,
sekannak wrote: GetelementId(
getElementById
|
|
|
|
|
As an improvement to this, you may want to wrap this javascript into a custom validator and include server side validation also.
|
|
|
|
|
Any one plz help me how to bind Gridview inside the Listview control
|
|
|
|
|
Hi,
U mean,inside Gridview, Listbox is a Itemtemplate...
page_load()
{
u have to create the function as a dataset, within the function u have to take the id,text from the query.
}
DesingView:
Then u have to call the function like,
<asp:listbox datasource="<%# fnPopulateDropDownListSpl() %>" datatextfield="textfield" datavaluefield="ValueField">
regards,
kannak....
kannak
|
|
|
|
|
Thanks,
That's ok. If i bind the gridview to inside the listview control how it will work?
It's like expand and collaspe button modal.
|
|
|
|
|
Insert a Grid View in item Template of ListView view below code
The code is tested .
<asp:ListView ID="ListView1" runat="server"
onitemdatabound="ListView1_ItemDataBound1">
<LayoutTemplate>
<table border="0" cellpadding="3" cellspacing="0" width="97%">
<tr class="lstheader">
<td width="15%">
Col one</td>
<td width="15%">
Grid Column</td>
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr >
<td>
<asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
</td>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Department" DataField="Department" />
</Columns>
</asp:GridView>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr >
<td>
<asp:Label ID="lblDate" runat="server" Text='<%#Bind("DepartmentID") %>'></asp:Label>
</td>
<td>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Department" DataField="Department" />
</Columns>
</asp:GridView>
</td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
now firstly Bind the ListView Control as below
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
fillgrid();
clsDepartment dpt = new clsDepartment();
ListView1.DataSource = dpt.SelectAll();
ListView1.DataBind();
}
}
Implement the ItemDataBound event of ListView and Find The Gridview. After Finding bind it
protected void ListView1_ItemDataBound1(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
GridView Grd = e.Item.FindControl("GridView1") as GridView;
if (Grd != null)
{
clsDepartment dpt = new clsDepartment();
Grd.DataSource = dpt.SelectAll();
Grd.DataBind();
}
}
}
|
|
|
|
|
It's working fine. Thanks.
I need to expand and collapse the ID (Department-ID) the department details will be display in gridview or (listview).
Plz help me....
Thanks.
|
|
|
|
|
|
You Can Use "CollapsiblePanelExtender" inside Listview for expand and collapse
Below code.
<asp:ListView ID="ListView1" runat="server"
onitemdatabound="ListView1_ItemDataBound1">
<LayoutTemplate>
<table border="0" cellpadding="3" cellspacing="0" width="97%">
<tr >
<td width="15%">
Col one</td>
<td width="15%">
Grid Column</td>
</tr>
<asp:PlaceHolder ID="itemPlaceholder" runat="server"></asp:PlaceHolder>
</table>
</LayoutTemplate>
<ItemTemplate>
<tr >
<td>
<asp:Label ID="lblDepartmentID" runat="server" Text='<%# Bind("DepartmentID") %>'></asp:Label>
</td>
<td>
<asp:LinkButton CausesValidation="false" ID="lnkexp" runat="server">+</asp:LinkButton>
<asp:LinkButton CausesValidation="false" ID="lnkCol" runat="server">-</asp:LinkButton>
<asp:Label ID="Label3" runat="server" Text="panel"></asp:Label>
<asp:Panel ID="pnl1" runat="server" >
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Department" DataField="Department" />
</Columns>
</asp:GridView>
</asp:Panel>
<cc1:CollapsiblePanelExtender ExpandControlID="lnkexp" CollapseControlID="lnkCol" TargetControlID="pnl1" ID="CollapsiblePanelExtender2" runat="server" TextLabelID="Label3" ExpandedText="collapse" CollapsedText="expand" SuppressPostBack="True" Collapsed="True">
</cc1:CollapsiblePanelExtender>
</td>
</tr>
</ItemTemplate>
<AlternatingItemTemplate>
<tr >
<td>
<asp:Label ID="lblDepartmentID" runat="server" Text='<%# Bind("DepartmentID") %>'></asp:Label>
</td>
<td>
<asp:LinkButton CausesValidation="false" ID="lnkexp" runat="server">+</asp:LinkButton>
<asp:LinkButton CausesValidation="false" ID="lnkCol" runat="server">-</asp:LinkButton>
<asp:Label ID="Label3" runat="server" Text="panel"></asp:Label>
<asp:Panel ID="pnl1" runat="server" >
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Department" DataField="Department" />
</Columns>
</asp:GridView>
</asp:Panel>
<cc1:CollapsiblePanelExtender ExpandControlID="lnkexp" CollapseControlID="lnkCol" TargetControlID="pnl1" ID="CollapsiblePanelExtender2" runat="server" TextLabelID="Label3" ExpandedText="collapse" CollapsedText="expand" SuppressPostBack="True" Collapsed="True">
</cc1:CollapsiblePanelExtender>
</td>
</tr>
</AlternatingItemTemplate>
</asp:ListView>
And change to item databound will be as follow
protected void ListView1_ItemDataBound1(object sender, ListViewItemEventArgs e)
{
if (e.Item.ItemType == ListViewItemType.DataItem)
{
Panel pnl = (Panel)e.Item.FindControl("pnl1");
if (pnl != null)
{
GridView Grd = pnl.FindControl("GridView1") as GridView;
if (Grd != null)
{
clsDepartment dpt = new clsDepartment();
Grd.DataSource = dpt.SelectAll();
Grd.DataBind();
}
}
}
}
Now Apply Images and Styles yourself
|
|
|
|
|
Thanks Zafar.
It's working fine.
Thanks a lotttt.
|
|
|
|
|
Hello,
I am having a table in my databse with columns
ACCOUNT_CODE NARRATION
i filled dropdown list with account code values from the database.
now my question is:
when i select the p[articular item in the dropdown list,
the narration textbox must be filled from the database based on the
selected item.
Plz,help me....
Thanks in advance
|
|
|
|
|
Did you struck somewhere ? You said you have added values from the database to dropdownlist.
In DropDownList1_SelectedIndexChanged event, you can write code for creating textbox dynamically, bind it with database value and add it to the form.
Dim txt As New TextBox()
txt.Text = "Sample value from the database"
Me.form1.Controls.Add(txt)
Make the controls AutoPostBack property as "True".
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|
|
I use passwordstrength control in my project.But when I run the page an error occure that Type 'AjaxControlToolkit.PasswordStrength' does not have a public property named 'StrengthStyles'..Please give me a solution as early as possible
Thanks & Regards
m_k
|
|
|
|
|
Take and read this article[^].
I Love T-SQL
"Don't torture yourself,let the life to do it for you."
If my post helps you kindly save my time by voting my post.
|
|
|
|
|
try the following. i have tested but do not get any error.
but text in "TextStrengthDescriptions" should be equal to the styles specified in "StrengthStyles"
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<cc1:PasswordStrength TargetControlID="TextBox1" PreferredPasswordLength="10" TextStrengthDescriptions="very Poor;weak;Average;strong" StrengthStyles="cls1;cls2;cls3;cls4" PrefixText="Strength : " StrengthIndicatorType="text" ID="PasswordStrength1" runat="server">
</cc1:PasswordStrength>
if do not work then check your web.config have you added the following in <system.webserver> section
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.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=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
|
|
|
|
|
Still I hve the same error. My code is here
ajaxToolkit:PasswordStrength runat="server" ID="PasswordStrength1" TargetControlID="Password" DisplayPosition="RightSide" PreferredPasswordLength="5" CalculationWeightings="25;25;15;35" RequiresUpperAndLowerCaseCharacters="true" TextStrengthDescriptions="Poor; Weak; Good; Strong; Excellent" HelpStatusLabelID="lblhelp" StrengthIndicatorType="BarIndicator"
HelpHandlePosition="AboveLeft"
BarBorderCssClass="barIndicatorBorder" StrengthStyles="barIndicator_poor; barIndicator_weak; barIndicator_good; barIndicator_strong; barIndicator_excellent">
Thanks
|
|
|
|
|
post your code please
Education is not a way to escape poverty — it is a way of fighting it.
|
|
|
|