|
Sorry The Code is Here.........
********** Java Script Page ***********
var XmlReq;
var ServerPageName = "Handlegriddata.aspx";
function CreateXmlReq()
{
debugger;
try
{
XmlReq = new ActiveXObject("Msxml2.XMLHTTP");
}
catch(e)
{
try
{
XmlReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch(oc)
{
XmlReq = null;
}
}
if(!XmlReq && typeof XMLHttpRequest != "undefined")
{
XmlReq = new XMLHttpRequest();
}
}
function FetchDGContents(text)
{ debugger ;
var requestUrl = Handlegriddata.aspx + "?Registardata=" + text;
CreateXmlReq();
if(XmlReq)
{
XmlReq.onreadystatechange = HandleResponse;
XmlReq.open("GET", requestUrl, true);
XmlReq.send();
}
}
function HandleResponse()
{
debugger ;
if(XmlReq.readyState == 4)
{
if(XmlReq.status == 200)
{
FillTable(XmlReq.responseXML.documentElement);
}
else
{
alert("There was a problem retrieving data from the server." );
}
}
}
function FillTable(Txtdata)
{
debugger ;
var DsData = scity.getElementsByTagName('dsVal'); //dsval dataset
var tbl = document.getElementById('GridView1').getElementsByTagName("tbody")[0];
for(var i=0;i<DsData.context.childNodes(0).parentNode.childNodes.length;i++)
{
var row = document.createElement("TR");
row.setAttribute("className","text");
row.setAttribute("bgColor","#ECECEC");
for(var j=0;j<DsData.context.childNodes(0).childNodes.length;j++)
{
var cell = document.createElement("TD");
cell.innerHTML = auth.context.childNodes(i).childNodes(j).text;
row.appendChild(cell);
}
tbl.appendChild(row)
}
}
***********Handlegriddata.aspx******************
string XmlString, Regdata ;
string[] split;
DataSet DA= new DataSet("dsVal");
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
Regdata= Request["Registardata"];
if(Regdata.Length > 0 )
{
Response.Clear();
split=choice.Split(',');
DataTable dt = new DataTable("PresenterInfo");
DBLayer objdblayer = new DBLayer();
dt = objdblayer.getRSetSQL("Select PresenterName,PresenterAddress,InfavorOf,ExecutedBy from USERS..Presenter_Info where 1=2", DBLayer.SqlType.SqlQuery); //For table Structure
dt.Rows.Add();
for(int i=0 ;i<dt.Columns.Count;i++)
{
if(i<split.Length)
dt.Rows[0][i]=split[i].ToString().Trim();
else
break;
}
DA.Tables.Add( dt);
XmlString=DA.GetXml();
Response.Clear();
Response.ContentType = "text/xml";
Response.Write(XmlString);
Response.End();
}
else
{
Response.Clear();
Response.End();
}
}
else
{
Response.Clear();
Response.End();
}
}
************ PRequest.aspx****************
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dtresult = new DataTable();
DBLayer objdblayer = new DBLayer();
dtresult = objdblayer.getRSetSQL("Select PresenterName,PresenterAddress,InfavorOf,ExecutedBy from USERS..Presenter_Info where 1=2", DBLayer.SqlType.SqlQuery);
GridView1.DataSource = dtresult;
GridView1.DataBind();
dtresult.Rows.Add();
ds.Tables.Add(dtresult);
// AddToGrid.Attributes.Add("OnClick", "FetchDGContents()");
}
}
protected void AddToGrid_Click(object sender, EventArgs e)
{
string chString=TxtPName.Text+","+TxtPAdd.Text+","+TxtInf.Text+","+TxtExBy.Text;
AddToGrid.Attributes.Add("OnClick", "FetchDGContents(" + chString + ")");
}
**************************Design******************************
TxtPName TxtPAdd TxtInf TxtExBy (TextBox Fill By User)
ADDBUTTON (after Fill the TextBox When User click on Add Button the txt Value go to Grid and TxtBox will Blank
Notes: on AddButton Its Create One Blank Rows and then add That value to that row)
GRIDView
****************************************************************
When User Click On GridView Row The Seleted Row Value will Display on TextValue (Now i work on it but not yet done)
|
|
|
|
|
i want to print my report through crystal report and in this report i want some selected text bold i.e. "Gorge is a cool guy" in which i want to print guy in bold letter.so what is the way to print it on crystal report in which text are coming dynamically through text box or label. i was try with label but it print tag also on report i.e. if i use cool then it will come on report as it is. if anybody have solution the please forward me..............
Thanks in advance.......
|
|
|
|
|
Hi,
There is a requirement in my FBA(Form based authentication) based ASP.NET application to handel session timeout.
After session timeout if user clicks any link or button it should return to Login page. I am using Master page also.
Thanks in advance.
|
|
|
|
|
Elena2006 wrote: After session timeout if user clicks any link or button it should return to Login page. I am using Master page also.
You need to check the session value on every page load. if this value is null redirect user to login page,
Abhijit Jana | Codeproject MVP
Web Site : abhijitjana.net
Don't forget to click "Good Answer" on the post(s) that helped you.
|
|
|
|
|
Keep Session timeout in web .config file.It automatically handles session timeout value..!
Check the below settings ,Check sessiontomeout..!
<system.web>
<authentication mode="Forms">
<forms loginUrl="Login.aspx"
protection="All"
timeout="30"
name=".ASPXAUTH"
path="/"
requireSSL="false"
slidingExpiration="true"
defaultUrl="default.aspx"
cookieless="UseDeviceProfile"
enableCrossAppRedirects="false" />
</authentication>
</system.web>
LatestArticle :Log4Net
Why Do Some People Forget To Mark as Answer .If It Helps.
|
|
|
|
|
It would be better to use asp.net Profile. Google about it and you'll get understanding of it.
Please don't forget to mark 'Good Answer', if you find it really a good one!
Kashif
|
|
|
|
|
hi All
I want a gridview in this I will have a row and "add" button in the last colomn,
when i click the add button same row should repeat.And if i want to delete it should be possible(window application)
Please help me with this.
thanks in advance
Ramkumar
("When you build bridges you can keep crossing them. ")
http://ramkumarishere.blogspot.com
modified on Wednesday, November 25, 2009 9:06 PM
|
|
|
|
|
Design a gridview with template columns and add button on the last column. In the button click event handler, add a new row to the grid's datasource and Bind() .
Best wishes,
Navaneeth
|
|
|
|
|
Ramkumar_S wrote: it should be possible(window application)
This is asp.net forum my friend..!
If you want in asp.net
http://www.codeproject.com/KB/aspnet/InsertingWithGridView.aspx
|
|
|
|
|
I have a User Control with a property declared internal bool AllowAllDepartments { get; set; } . However, whether I declaratively set this property where the control is sited, e.g. '...AllowAllDepartments="True"...', or programmatically in the Page_Load of the host page, when I hit a breakpoint in the Page_Load of the user control, the property still has a value of false. What am I doing wrong?
|
|
|
|
|
I have no idea. What happens if you factor this out so you have actual get and set methods you can put a breakpoint in ? That way, you can see if they are being set at all, and/or set when you don't intend it.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
If you are using just this
internal bool AllowAllDepartments { get; set; }
it is impossible to have value false just after execution of the line
AllowAllDepartments= true (I removed Quotations" as they are not necessary)
If this is not so, it might be the case that you forgot to set the value to local variable in setter of the property and/or you didnt get the appropriate value from the variable in getter property.
|
|
|
|
|
Hello,
I have one treeview in updatepanel and one asp pannel(with visible = "false") out-side updatepanel.
On selectedIndexchanged of treeview, I want a pannel outside of updatepanel needs to be visible.
But it is not working. Is there any work around so that I can make my pannel visible w/o postback?
Thanks in advance.
Regards,
Milind.
|
|
|
|
|
If it's not inside an update panel, then you'd need to write your own javascript to make it visible.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
All the content that is inside the Update panel will be posted back to the client and refreshed in the client as response. So it is impossible to update controls outside updatepanel from the server.
As Christian suggested, you need to pass some Javascript to the client which might show the Panel.
But there is another scenario. ASP.NET doesnt render controls that are made Visible=false. So from client side using javascript, you will not going to find the control.
So the solution will be :
1. Use pnl.Style.Add(HtmlTextWriterStyle.Display, "none") to make the panel invisible instead of pnl.Visible=false //To ensure that pnl is rendered in the client.
2. In postback of UpdatePanel use RegisterStartupScript to pass a javascript that resets the pnl.style. Your javascript might look like
"document.getElementById('" + pnl.ClientId + "').style.display='none';"
|
|
|
|
|
Or you could put ASP:Panel inside another update Panel and set it's update mode to Always,
But I think javascript will still be better
|
|
|
|
|
Hi,
I have a code here which makes the active links bold in IE7
Is there some work around to make it work in mozilla and higher versions of IE
a:active{font-weight:bold}
Thanks
Shankbond
|
|
|
|
|
What happened to you. It should be perfectly working in all browsers.
|
|
|
|
|
Don't know but not working on my end?
Any suggestions
Thanks
Shankbond
|
|
|
|
|
I think there must be some other css which overrides this. Check out.
You Can make a css class for the same and add using javascript when mouse comes over the anchor. Its an easy fix.
Or you can also use span to behave similar to anchor. Use onclick to navigate in span.
You can take either approach I think.
|
|
|
|
|
Hi guys,
Recently I've been experimenting with converting csv files from Yahoo Finance to XML data, and there is a great article on MSDN site about how to do so, with sample code provided. However, there's a "GenerateDataSet" class that fails to get recognized by my VWD 2008 Express, and I've tried importing all sorts of possible namespaces. After doing some research, it seems to be a Windows Form component rather than a web form component. I understand that the "GenerateDataSet" class is supposed to put the csv datastream into a dataset, however I'm not familiar enough with asp.net to come up with an alternative to make it work. Could you please help me? I'd greatly appreciate it!
Part of the sample code provided by MSDN (this function is supposed to read csv data online and return XML data:
<br />
Public Function getStockXML(ByVal strTicker As String, ByVal strStartDate As String, ByVal strEndDate As String) As XmlDocument<br />
Dim xReturn As New XmlDocument()<br />
Dim result As New DataSet()<br />
Dim wc As New WebClient()<br />
Dim yData As Stream = wc.OpenRead(sYahooURI) 'sYahooURI is the url link to Yahoo Finance csv file<br />
result = GenerateDataSet(yData)<br />
<br />
Dim stringWriter As New StringWriter()<br />
Dim xmlTextwriter As New XmlTextWriter(stringWriter)<br />
result.WriteXml(xmlTextwriter, XmlWriteMode.IgnoreSchema)<br />
Dim xRoot As XmlNode = xReturn.CreateElement("root")<br />
xReturn.AppendChild(xRoot)<br />
xReturn.LoadXml(stringWriter.ToString())<br />
Return (xReturn)<br />
End Function<br />
|
|
|
|
|
csv means Comma separated values. Why dont you use normal for loops to put all the values into a DataTable .
If you cant do it yourself, let me know with a sample demo of the schema. I will give you the code.
|
|
|
|
|
Thank you so much Abhishek for your help. I actually have thought about using for-next loops before, but when seeing the example posted on MSDN is doing it using a simple "GenerateDataSet" function, I thought it's a shortcut.
The original CSV file from Yahoo Finance looks like the following:
Date,Open,High,Low,Close,Volume,Adj Close
2009-10-23,15.91,16.10,15.41,15.48,27610400,15.48
2009-10-22,15.15,15.51,15.01,15.43,17517400,15.43
Basically I'm just having problem with the "result = GenerateDataSet(yData)" line, because I couldn't find the namespace that "GenerateDataSet" is under. If you could please give me the code for writing that csv stream into a dataset, that would be great!
Public Function getStockXML(ByVal strTicker As String, ByVal strStartDate As String, ByVal strEndDate As String) As XmlDocument<br />
Dim xReturn As New XmlDocument()<br />
Dim result As New DataSet()<br />
Dim wc As New WebClient()<br />
Dim yData As Stream = wc.OpenRead(sYahooURI)<br />
result = GenerateDataSet(yData)<br />
Dim stringWriter As New StringWriter()<br />
Dim xmlTextwriter As New XmlTextWriter(stringWriter)<br />
result.WriteXml(xmlTextwriter, XmlWriteMode.IgnoreSchema)<br />
Dim xRoot As XmlNode = xReturn.CreateElement("root")<br />
xReturn.AppendChild(xRoot)<br />
xReturn.LoadXml(stringWriter.ToString())<br />
Return (xReturn)<br />
End Function
For your information, here's the link to that MSDN website:
http://msdn.microsoft.com/en-us/magazine/ee294455.aspx[^]
Thanks again for your help!
|
|
|
|
|
|