|
I need Double click event only.
Thanks
Kusuma
|
|
|
|
|
Hey
How to show confirmation message with yes or no option in Asp.net page 2.0. The confirmation message to be showed only on certain condition not on any button click.
The scenario is: While creating a user, need to check user name exists in DB, if exists then confirmation message “User name already exists, Do you want create user of same name .Yes and No? “. For this situation I need confirmation message.
Thanks
Kusuma
|
|
|
|
|
The easist way would be to simple display the message as a label on the page after a postback checked if a user existed.
Another way would be for an AJAX call to check the user then you could use the JavaScript confirm function
only two letters away from being an asset
|
|
|
|
|
|
I have a gidview. Inside one cell I want to show only 20 characters and rest have to hide.Can anybody help please
|
|
|
|
|
I think you are saying you only want show the first 20 characters and then truncate after that. If you changed the column to a template column you could do a special binding statement that would only grab the first 20 characters.
Something like:
<asp:TemplateField HeaderText="Your ColumnName Here" >
<ItemTemplate >
<asp:Label id="lbYourCOlumnName" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"YourColumnName").ToString().SubString(0,20) %>'></asp:Label>
</ItemTemplate>
Hope that helps.
Ben
|
|
|
|
|
Thanks, I am doing in Asp.net/c#.
|
|
|
|
|
//
dear sir i couldn't able to refer/using Sessions in global.asax under the Application_AcquireRequestState Method.I m getting Application Exception. But it works fine when using..Cookies.Any Suggestions are Greatly appreciated. thanks.
1.Moreover after generating Exceptions the Application is executing with Distortion in StyleSheet Settings.
2.I Searched Alot in Web .But No Source.
//
protected void ddlLanguage_SelectedIndexChanged(object sender, EventArgs e)
{
// I'm initializaing Sessions Based on culture selected from dropDownlist Box
Thread.CurrentThread.CurrentUICulture = new CultureInfo(name); // name="es-US" say,
Thread.CurrentThread.CurrentCulture = new CultureInfo(locale); // locale ="es-US" say,
......
Session["MyUICulture"] = name;
Session["MyCulture"] = locale;
...
}
void Application_AcquireRequestState(Object sender, EventArgs e)
{
// override automatic culture selection from <globalization>
// based on the user's selection which was stored in a cookie
try
{
if (Session.Contents["MyUICulture"] != null && Session.Contents["MyCulture"] != null)
{
System.Globalization.CultureInfo uiCulture = new System.Globalization.CultureInfo(Session["MyUICulture"].ToString());
System.Globalization.CultureInfo Culture = new System.Globalization.CultureInfo(Session["MyUICulture"].ToString());
System.Threading.Thread.CurrentThread.CurrentUICulture = uiCulture;
System.Threading.Thread.CurrentThread.CurrentCulture = Culture;
}
}
catch (HttpException ex)
{
throw new HttpException("Details:" + ex.Message);//Do Nothing.
}
}
Srikar M
|
|
|
|
|
Hi the following code inside if loop is not checking the condition...,
I want to check the if condition also...,
Any probs in my code...,
Plz any one clear my doubt....,
If CType(Maingrd.FindControl("ddlApprove"), DropDownList).SelectedItem.Text = "Paid" Then
Dim AppRgHrs As TextBox = CType(Maingrd.FindControl("txtAppRgHrs"), TextBox)
Maingrd.Cells(10).Text = Maingrd.Cells(7).Text
Maingrd.Cells(11).Text = Maingrd.Cells(7).Text
ElseIf CType(Maingrd.FindControl("ddlApprove"), DropDownList).SelectedItem.Text = "Not Paid" Then
Maingrd.Cells(10).Text = hrs & ":" & sec
Maingrd.Cells(11).Text = hrs & ":" & sec
Dim AppRgHrs As TextBox = CType(Maingrd.FindControl("txtAppRgHrs"), TextBox)
AppRgHrs.Text = ""
Dim NWhrs As Integer = Maingrd.Cells(7).Text
If hrs > NWhrs Then
Dim crghrs As Integer = hrs - 1
Maingrd.Cells(12).Text = crghrs & ":" & sec
Else
Maingrd.Cells(12).Text = hrs & ":" & sec
End If
End If
Magi
|
|
|
|
|
It appear to me that if the selecteditem = "Not Paid" then there may not be anything in Cells(7).Text. I would think that perhaps you want to use Cells(10).text. Also I don't see where hrs is getting set so that may be a problem too. Kind of hard to tell without seeing more code.
Ben
|
|
|
|
|
Magh_M wrote: inside if loop is not checking the condition...,
Impossible.
Set a breakpoint and step through to see what is really happening.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Dim AppRgHrs As TextBox
decalre it out side if and use it inside if
condition
else u can't refer it further
vijaya
|
|
|
|
|
Hi,
I have a dotnet application in which i have to take text documents from a specified folder in a selected date criteria. i'm using date picker for this. Suppose if i have to fetch the files form some 30/11/2006 to 31/11/2006. For that there will be a folder created in the client name inside the folder there will be folders created in the name 3011 and 3111 respectively with the corresponding dates which has been coded already in the same project. my question is i have to fetch those records if i select a from data and todate and click submit it has to fetch the records from the folder and has to be displayed ascendingly according to the date specified. i've just started working on it and i have been struggling in the middle. can anybody pls help me with a proper solution. i'm struggling with this.. here is the code which i have completed.
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.Odbc;
using System.Configuration;
using System.Globalization;
using System.IO;
using System.Text;
using My_Sql;
namespace hsusa
{
///
/// Summary description for NewClientRecords.
///
public class NewClientRecords : System.Web.UI.Page
{
protected eWorld.UI.CalendarPopup CalTxtFromDate;
protected System.Web.UI.WebControls.Label lblDictTo;
protected eWorld.UI.CalendarPopup CalTxtToDate;
protected System.Web.UI.WebControls.Button btnSearch;
protected System.Web.UI.WebControls.DataGrid MultiDocumentGrid;
protected System.Web.UI.WebControls.Label lblDictFrom;
public string lbl;
protected BunnyBear.msgBox MsgBox1;
protected System.Web.UI.WebControls.Label lblMessage;
protected System.Web.UI.WebControls.Label Label3;
protected OdbcConnection UserCon;
protected OdbcDataAdapter UserAdap;
protected OdbcCommand UserCmd;
DateTime FromDate;
protected System.Web.UI.WebControls.Button Button1;
DateTime ToDate;
string Accname;
string FolderName;
string strUserAcc;
int EDIT;
int VIEW;
int PRINT;
private void Page_Load(object sender, System.EventArgs e)
{
// string z = Session["UserName"].ToString();
//
// //string z = "hsusa" ;
////
// strUserAcc = GetUserAcc(z).ToString();
////
// GetUserPermissions(z);
}
private void Button1_Click(object sender, System.EventArgs e)
{
//string z = "hsusa" ;
//strUserAcc = GetUserAcc(z).ToString();
//GetUserPermissions(z);
if(CalTxtFromDate.SelectedDate>CalTxtToDate.SelectedDate)
{
MsgBox1.alert("From date cannot be greater than to date");
}
else if(CalTxtFromDate.SelectedDate > DateTime.Now.Date)
{
MsgBox1.alert("From-Date cannot be greater than Current-date");
}
else if(CalTxtToDate.SelectedDate > DateTime.Now.Date)
{
MsgBox1.alert("To-Date cannot be greater than Current-date");
}
else
{
// FromDate = CalTxtFromDate.SelectedDate.AddDays(1);
// ToDate = CalTxtToDate.SelectedDate.AddDays(1);
// Get folders in between these dates
FromDate = CalTxtFromDate.SelectedDate;
ToDate = CalTxtToDate.SelectedDate;
string FolderDay = FromDate.Day.ToString();
string FolderMonth = FromDate.Month.ToString();
string FolderDay1 = ToDate.Day.ToString();
string FolderMonth1 = ToDate.Month.ToString();
if(int.Parse(FolderDay) <=9&&int.Parse(FolderMonth) <=9)
{
FolderName = "0" + FolderMonth + "0" + FolderDay.Trim();
}
else if(int.Parse(FolderDay) <=9)
{
FolderName = FolderMonth + "0" + FolderDay.Trim();
}
else if(int.Parse(FolderMonth) <=9)
{
FolderName = "0" + FolderMonth + FolderDay.Trim();
}
else
{
FolderName = FolderMonth + FolderDay.Trim();
}
if(int.Parse(FolderDay1) <=9&&int.Parse(FolderMonth1) <=9)
{
FolderName = "0" + FolderMonth1 + "0" + FolderDay1.Trim();
}
else if(int.Parse(FolderDay1) <=9)
{
FolderName = FolderMonth1 + "0" + FolderDay1.Trim();
}
else if(int.Parse(FolderMonth1) <=9)
{
FolderName = "0" + FolderMonth1 + FolderDay1.Trim();
}
else
{
FolderName = FolderMonth1 + FolderDay1.Trim();
}
try
{
string file;
string[] files;
string filepath;
int last;
//string Accname = Request.Params["Accname"].ToString();
Accname = "SMITH" ;
//Accname = strUserAcc;
DataTable dataTable=new DataTable();
dataTable.Columns.Add(new DataColumn("TextFileName"));
dataTable.Columns.Add(new DataColumn("Date"));
//dataTable.Columns.Add(new DataColumn("DocumentFullPath"));
DataRow dataRow;
filepath = "d:\\Text\\" + Accname + "\\" + FolderName;
files = Directory.GetFiles(@filepath);
for(int i=0;i<files.length;i++)
{
=""
="" datarow="dataTable.NewRow();" file="Path.GetFullPath(files[i]);
" last="file.LastIndexOf("\\");" int="" fileindex="last+1" ;
="" string="" filename="file.Substring" (fileindex);
="" datarow["documentfullpath"]="file;
" datarow["textfilename"]="Filename" datarow["date"]="FolderName;
" datatable.rows.add(datarow);="" }
="" dataset="" dataset();
="" dataset.tables.add(datatable);
="" multidocumentgrid.datasource="dataSet;
" multidocumentgrid.databind();
="" }
="" catch(exception="" ex)
="" label3.text="File Not Found." }=""
="" private="" void="" multidocumentgrid_itemdatabound(object="" sender,="" datagriditemeventargs="" e)
="" {
="" textfilename="e.Item.Cells[2].Text.Trim();
" if="" (edit="=" 0)="" e.item.cells[0].controls.add(new="" literalcontrol("<a="" href="#" onclick="\"window.open('DisplayNew.aspx?PrintDoc=N&FileName="" +="" "&acname=" + Accname + " &foldername=" + FolderName + " ','text','menubar="false')\"">" + TextFileName + ""));
e.Item.Cells[0].Controls.Add(new LiteralControl(" "));
}
else
{
e.Item.Cells[0].Controls.Add(new LiteralControl("" + TextFileName + ""));
// e.Item.Cells[0].Controls.Add(new LiteralControl(" "));
}
}
}
}
Thanks and Regards
Vijay.
|
|
|
|
|
I couldn't really follow your explanation because of the lack of punctuation, it's really hard to read something when you can't tell where one sentence ends and the next begins. You posted your code without using the pre tag, so it lost all indentation, so I didn't even try to read it. You should also post only the relevant code, not your entire project.
It would also help if you specified a little more clearly what it is your are "struggling" with in the "middle".
---
single minded; short sighted; long gone;
|
|
|
|
|
Guffa wrote: it lost all indentation, so I didn't even try to read it
|
|
|
|
|
I have a Datagrid. I am taking a selected row to the datatable(session).My problem is inside the datagrid in one cell there is a textbox. the value from the textbox is not binding to datatable. Can anybody help please.
|
|
|
|
|
Hi,
Can you post your code how do u store rows in the session?
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
DataTable dt = new DataTable();
dt.Columns.Add("feild1", System.Type.GetType("System.Int32"));
dt.Columns.Add("feild2", System.Type.GetType("System.String"));
dt.Columns.Add("feild3", System.Type.GetType("System.String"));
dt.Columns.Add("feild4", System.Type.GetType("System.String"));
dt.AcceptChanges();
DataRow l_rowDetails = dt.NewRow();
l_rowDetails["feild1"] = (GridView1.SelectedRow.Cells[1].Text);
l_rowDetails["feild2"] = GridView1.SelectedRow.Cells[2].Text;
l_rowDetails["feild3"] = GridView1.SelectedRow.Cells[3].Text;
l_rowDetails["feild4"] = GridView1.SelectedRow.Cells[4].Text;
dt.Rows.Add(l_rowDetails);
dt.AcceptChanges();
Session["datatable"] = dt;
|
|
|
|
|
Hi,
Here u r pushing text of the cell.
If u want to take value from the textbox then you should find textbox in the cell and then take its text property and insert it in to the table.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
sasim@choice-solutions.com
sasim
|
|
|
|
|
HI,
You can not create a dynamic event handler but you can assign an existing one to an event of dynamic control.
1. Create a handler which u want to call when event happens.
2. Assign that to the event of your dynamic control.
protected void bttn_Click(object sender, EventArgs e)
{
//Code;
}
Create dynamic button and assign above event handler to its click event.
button bttn = new Button();
bttn.Click += new EventHandler( bttn_Click );
I hope this will help u.
Thanks and Regards,
Chetan Ranpariya
|
|
|
|
|
How do I implement or write javascript in source -> means in aspx. File
If I write as java script code I can’t access the normal button like label etc.
I want to execute function when form is loaded
How to do it?
To test I have written code like this
1.
function getlabel()
{ alert("formload");
alert(Text1.value)}
2.
void getlabel()
{
Response.Write(Label2.Text);
Response.Write(TextBox1.Text);
}
…..
neigther of this method is working
.
vijaya
|
|
|
|
|
Research the Page.RegisterClientScriptBlock method (ASP.NET 1.1) or ClientScript.RegisterClientScriptBlock (later versions - though the former will still work as well)
Fred
|
|
|
|
|
That seems like overkill for inline script wouldn't you say? Think he's asking how to add js directly into the aspx, rather than using the codebehind to register it...
"Knock me down, I'll get straight back up again, I'll come back stronger than a powered up pacman"
(Lilly Allen / Kaiser Chiefs)
|
|
|
|
|
Yes, ok - I think you're right. Oh well - two lessons for the price of one - a bargain!
Fred
|
|
|
|