|
dayakar_dn wrote: then second custom control not getting triggered
$("#" + ClientId + "_" + "spnPromoNotReg").hide();
Well first off, it's just a textbox, there's nothing custom about it. As far as triggering goes, it doesn't get triggered, JQuery has to be able to find that textbox in order to alter the visiblity of the textbox. If it can't find it, it won't get altered to hide. Check your spelling, or alter the way you declare the name of the textbox.
args.IsValid
I don't see the code or declaration for if (args.IsValid) == true { so I can't comment on it. If the condition is not met, the code will never execute.
|
|
|
|
|
I developed an enterprise solution but the main problem is the bostback and the refresh and the time for update the data
now search about best solution for asp.net (c#) rich client
the main target to increase the performance and to be real time updating and i think that will not be applicable without use client side script (java sript)
so is there any solution or tools like json or jqurey can support me?
|
|
|
|
|
|
hi - i'm working on an asp.net page that has a DDL and depending on the DDL selection will display a gridview of results. Here's the code I have so far:
Code:
<%@ Page Title="GDNI_SalesmanManager" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="GDNI_SalesmanManager.aspx.cs" Inherits="GDNI_Salesman_Manager.About" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<style type="text/css">
.style1
{
width: 251px;
height: 120px;
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<h2>
Customer:
<asp:DropDownList ID="ddlCustomers" runat="server" Height="17px"
ToolTip="Customers" Width="285px">
</asp:DropDownList>
</h2>
<p>
<asp:GridView ID="gvProductClass" runat="server">
</asp:GridView>
</p>
</asp:Content>
<pre lang="c#">
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
namespace GDNI_Salesman_Manager
{
public partial class About : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["BB_Datawarehouse_DB"].ConnectionString;
string str;
SqlCommand com;
protected void Page_Load(object sender, EventArgs e)
{
ddlCustomers.AutoPostBack = true;
if (!IsPostBack)
Populate_ddlCustomers();
} //in debug mode the code skips to site.master page load event
public void Populate_ddlCustomers()
{
ddlCustomers.Items.Add("Please Select a Customer");
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "exec dbo.sp_GetCustNumAndDSeq";
com = new SqlCommand(str, con);
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
{
ddlCustomers.Items.Add(reader["Customer"].ToString());
}
reader.Close();
reader.Dispose();
}
protected void ddlCustomers_SelectedIndexChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "exec dbo.sp_GetProductClsCodeAndSalesman '" + ddlCustomers.SelectedItem.Text + "'";
com = new SqlCommand(str, con);
SqlDataReader reader = com.ExecuteReader();
while (reader.Read())
{
gvProductClass.DataSource = reader;
gvProductClass.DataBind();
}
reader.Close();
con.Close();
}
}
}
at the minute i'm struggling to get the code to step into the protected void ddlCustomers_SelectedIndexChanged see above comment
|
|
|
|
|
here's the answer to my question; I didn't have the OnSelectedIndexChanged="ddlCustomers_SelectedIndexChanged" property set in the ASP properties of the drop down list
Code:
<asp:DropDownList ID="ddlCustomers" runat="server"
Height="17px" Width="285px"
ToolTip="Customers"
AppendDataBoundItems="true"
OnSelectedIndexChanged="ddlCustomers_SelectedIndexChanged">
<asp:ListItem >Please Select a Customer</asp:ListItem>
</asp:DropDownList>
|
|
|
|
|
How to change the image of the Imagebutton by clicking on it.
I wanna chanege it 4 times. Means 4 images available.
default is Black image
on 1st click it changed to Blue image
on 2nd click Green Image
on 3rd click Red image
and on 4th click again black image....
Button is used in Gridview..
|
|
|
|
|
Usually at this situation, I keep hidden imagebuttons and make it visible/hide accordingly.
Note: I am not sure if this is the right way to do this.
|
|
|
|
|
yes but it is possible only if we have only two images to toggle.
But here i have 4 images..
|
|
|
|
|
You Can check on each image button click event. Take a look at the algorithm below
if ( button.ImageURL = [Image1URL]) then
button.ImageURL = [Image2URL]
Else if (button.ImageURL == [Image2URL] ) THEN
button.ImageURL = [Image3URL]
ELSE IF (button.ImageURL == [Image3URL] THEN
button.ImageURL = [Image4URL]
ELSE
button.ImageURL = [Image1URL]
END IF
Hope this algorithm help you out..
|
|
|
|
|
I tried as u said and
My code is as below..
Protected Sub ImageButton2_Click1(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs)
For i As Integer = 0 To GridView1.Rows.Count - 1
Dim imgbutton As ImageButton = DirectCast(GridView1.Rows(i).Cells(2).Controls(0), ImageButton)
If imgbutton.ImageUrl = "~/Image/Red.png" Then
imgbutton.ImageUrl = "~/Image/Green.png"
ElseIf imgbutton.ImageUrl = "~/Image/Green.png" Then
imgbutton.ImageUrl = "~/Image/Blue.png"
ElseIf imgbutton.ImageUrl = "~/Image/Blue.png" Then
imgbutton.ImageUrl = "~/Image/Black.png"
Else
imgbutton.ImageUrl = "~/Image/Red.png"
End If
Next
End Sub
but it gives me an error like..
Specified argument was out of the range of valid values. Parameter name: index
in this code line--> Dim imgbutton As ImageButton = DirectCast(GridView1.Rows(i).Cells(2).Controls(0), ImageButton)
Any solution for that??
|
|
|
|
|
Hi
Specified argument was out of the range of valid values. Parameter name: index
the above error will occur if GridView1.Rows(i).Cells(2).Controls(0)is exceeding its range. check for the columns you have in grid, if suppose if you have only one row with 1 cell then grid you will receive the error as you mentioned.
Try to use Immediate window when you are debugging and check by copying "GridView1.Rows(1).Cells(2).Controls(0)" , if it throws error reduce the row and cell index numbers.
Hope this will help.
thanks
|
|
|
|
|
|
Hey thanks i tried your algo. First it gives me an error. but i solved it and its working well
|
|
|
|
|
|
Sir.. I have two pages in websites. I have a label and button on first page, for 'Postbackurl ' property of button of first page ,I have taken url of second page.. & I have taken another label on second page I have added ..
<System.Web>
<sessionState Timeout="1"/>
</System.Web> into web.config file
so when i run the page ..first page will be opened ..then after 1 min I clicked on button still second page successfully opened.
and I want show by using label that..." Session is expired ".
Thanks & Regards
-Rakesh
|
|
|
|
|
|
How can we update row in database table if browser is closed using C#,ASP.NET
|
|
|
|
|
You'll need to clarify your question. If the browser is closed you can't run any web application.
No comment
|
|
|
|
|
If you are talking about recording 'close' event of a browser, its pretty involved. For eg., session, cookies, browser version, browser type etc.
I would start with 'unload' event of IE.
You can never try. You either do it or you don't.
|
|
|
|
|
You can't: once the browser closes that's it.
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
You can use javascript's page unload event to run any server side code.
Hope this help you out.
|
|
|
|
|
Hi
I have fields empcode,empname,photoname,photoguid
I want to display it in gridview & want to give option to user to edit record & also if file is attached user should be able to open or delete that file & add new file to that record.
Thanx
|
|
|
|
|
Have you bothered to a) do any research or b) try something for youreslf?
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair.
nils illegitimus carborundum
me, me, me
|
|
|
|
|
I'm not a programmer, but I've managed to create our company's website in Visual Studio 2010 / VB / ASP.NET 4.0. I've also managed to use the apps_globalresources directory to add 9 languages to the website through advice in the forums. I can call these languages by clicking on a flag. I apologize for this message being lengthy, but anyone who could help would be a life-saver!
The Problem:
When I switch languages by clicking a flag, the text changes and it looks great. But the URL doesn't change. /about.aspx is still /about.aspx. It's just displaying the page using another language's resource (.resx) file.
What I've been told:
I've been told that having the same URLs for 9 different languages is bad SEO and bad web development practice. I've been told to use the "Page_Load" event to make my URLs like about.aspx?lang=nl for Dutch instead. They suggest this is better practice. I would LOVE to do this, but I'm not intelligent enough at programming to do so.
My current code:
<asp:LinkButton ID="LinkButton7" runat="server"
CommandArgument="nl" OnClick="RequestLanguageChange_Click" class="flagbutton">
<asp:Image ID="Image1" runat="server" ImageUrl="~/images/flagnl.png" tooltip="Bekijk deze website in het Nederlands" title="Bekijk deze website in het Nederlands"/>
<img class="map" src="images/flaghovernl.png" alt=""/>
</asp:LinkButton>
What I was told to do:
"Create a simple link that changes the language without a post back":
<a href="about.aspx?lang=nl">Nederelands</a>
Conclusion:
Now, I was told that with Page_Load you check to see if you find this parameter lang=el and if you find it you show this language resource, if not you show the default resource.
What does this mean? How can I implement this and where do I do so? Do I use the code-behind, or put it right on my master page? Or every page? Thank you for taking the time to read this novel, and I would sincerely appreciate any and all guidance you could offer me!
Jason Weber
http://on.fb.me/JasonPWeber
|
|
|
|
|
if (this.Request.QueryString["lang"] == "nl") DoRedirect();
Help people,so poeple can help you.
|
|
|
|