|
I have finally cracked it. No dummy databinds required or anything other than the findcontrol method.
The key is purely down to using the method at the correct time in the page life cycle.
I used the following to set a textbox to the current date and time.
where:
Formview ID = "Details"
Formview child Textbox to change ID = "Date_AddedTextBox"
(Textbox is in the insert template)
<br />
Protected Sub Details_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles Details.DataBound<br />
<br />
If Details.CurrentMode = FormViewMode.Insert Then<br />
<br />
Dim Test As TextBox = CType(Details.Row.FindControl("Date_AddedTextBox"), TextBox)<br />
Test.Text = Now()<br />
<br />
End If<br />
<br />
End Sub<br />
So ... if like me you have been to hell and back via the entire internet trying to do what seems like the simplest thing, trust your code as it is probably correct and try it at a time where the items have definitely been created and and data definitely bound (such as the event I used above) and you should have success.
|
|
|
|
|
This is how we can open a parent window from a chid window and the beauty to pass parameters
<code>
<a href="#" onclick='window.opener.navigate("forumTopics.asp?forumID=<%=forumID%>");window.close();'>myLink</a>
|
|
|
|
|
The men in the white lab coats are looking for you.
Was this supposed to be a question?
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
This isn't a question. I was having hard time doing this thing i wanted now I got the answer so I shared it. Somebody will be benefited
|
|
|
|
|
Rather than posting it in a fast moving forum, where it gets swallowed up and forgotten quickly, you could put it in the Wicked Code[^] forum.
My failometer is detecting vast quantities of FAIL!
"Its SQL - hardly programming..." (Caslen)
|
|
|
|
|
huh
|
|
|
|
|
I want users to be able edit a Word document that is on the server. I also want the server to host the Word application. I do not want the client computer to be required to have Word installed. Is this possible or is the only way to do it is to have the client have word installed?
|
|
|
|
|
If it is possible, it would require a third party component. ASP.NET itself plainly cannot do this, with what you get by default. That component would need to convert Word docs to HTML, send them to the client, use JS to create UI like word, then take the result and convert back to Word format. As Word can save as HTML. that may not be as hard as it sounds.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
|
I'm not a Javascript person, so please be kind. I've got an asp.net 2 page that has a master page. I've got a javascript that works fine in a regular asp.net page within the same web. Move it to the page with the master page, and it won't work. Any help appreciated. Also, what's the difference between function setDifference(form) and setDifference = function(form)? Here's the basic stuff:
<script>
setDifference = function(form)
{
var x = document.getElementById('dtTxt1').value;
var y = document.getElementById('dtTxt2').value;
var dt1 = Date.parse(x)
var dt2 = Date.parse(y)
document.getElementById('resultTxt').value = (dt1.valueOf() - dt2.valueOf()) / (60 * 60 * 24 * 1000)
}
</script>
<asp:TextBox ID="dtTxt1" name="dtTxt1" runat="server" onkeyup="javascript:setDifference(this.form);" onkeydown="javascript:setDifference(this.form);" />
<asp:TextBox name="dtTxt2" id="dtTxt2" runat="server" onkeyup="javascript:setDifference(this.form);" onkeydown="javascript:setDifference(this.form);" />
<asp:textbox name="resultTxt" id="resultTxt" runat="server" />
|
|
|
|
|
This is creating a function, which takes form as a parameter, and is called setDifference. I don't think in this instance that it would matter if you removed the = function part. I could be wrong, I am no JS master, either.
What does 'won't work' mean, do you get any errors ? Have you tried using firebug in firefox to debug the script ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Christian,
Won't work means that no calculation takes place. Nothing happens. And, as I'm really unfamiliar with Javascript, don't know how to use Firebug in Firefox to debug.
Janet
|
|
|
|
|
The easiest way to debug is to use alert statements, as in
alert("I got this far);
or
alert("The value of X = " + x);
This will create popup messages. Also, the browser will show you if it thinks there was a js error. So, I'd start with an alert at the top of the function, telling you if it got called or not.
Firebug is an add in for firefox, it lets you set breakpoints in your js and step through. It's awesome.
I would say best guess is that where your script is going, the scope means it doesn't get called, but it's best to go through and make sure that is true.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
When using the master pages, the form elements get rendered with different ID's...I mean to say 'dtTxt1' will be rendered as something 'ctl00_dtTxt1'.
You need to check whether the element ID's that are being used actually exist in the page or not.
So try the following...
var x = document.getElementById('ctl00_dtTxt1').value;
var y = document.getElementById('ctl00_dtTxt2').value;
But before doing this check if the element ID is actually appended with ct100 or some other value.
"Don't worry if it doesn't work right. If everything did, you'd be out of a job." (Mosher's Law of Software Engineering)
|
|
|
|
|
Thanks for the reply. I tried that, with no result. I also tried the following in both the master and the child page:
var ouptut = document.getElementById('<%= resultTxt.ClientID %>').value;
var x = document.getElementById('<%= dtTxt1.ClientID %>').value;
var y = document.getElementById('<%= dtTxt2.ClientID %>').value;
var dt1 = Date.parse(x)
var dt2 = Date.parse(y)
output.value = (dt1.valueOf() - dt2.valueOf()) / (60 * 60 * 24 * 1000)
|
|
|
|
|
I have a windows form application that creates a filestream object and
> then
> calls my webservice passing the filestream object.
>
> I got an error message can't convert windows application filestream to
> type
> webservice filestream.
>
> They are both the same type
Please help meeee
Raghvendra
|
|
|
|
|
Isn't the error descriptive enough? How do you plan to use Windows application filestream in your webservice? Simply, you are trying the impossible.
|
|
|
|
|
Please Send The Code and Error Description
Shaikh Tauhid Hasan
|
|
|
|
|
I'm having a problem with login control.I have three pages called login,secret and register.I secured my secret page by using login control and if i request my secret page it redirect me to the login page that is fine to me.but problem is that if from here i click on the regiser link it does not direct to the register page untill i fill any correct enrty.if i fill correct login/password it direct me to the secret page.now if i come back to the login page and now click the register link it dirct me to the register page.thts fine now.
i have used createtext and createtexturl property of login control.please help me in this regard...
I have the follwing code in web config file.
<roleManager enabled="true"/>
<authentication mode="Forms"/>
<authorization>
<deny users="?"/>
</authorization>
and following in the source file
<asp:Login ID="Login1" runat="server" DestinationPageUrl="~/Secret.aspx" CreateUserText="New User Register" CreateUserUrl="~/register.aspx" FailureText="You are not registered.....try agian..">
/>
|
|
|
|
|
aarsh thakur wrote:
<authorization>
<deny users="?"/>
</authorization>
This means that only authenticated users will have access to your site, I believe that you are having access to LogIn.aspx because thats the default login page
You should add a folder (members or something) and add a deny users = "?" for that folder only either with a location element or a new web.config inside the members folder
Alexei Rodriguez
|
|
|
|
|
Thanx for your response .
sir,
my application is running fine if any authorized user enters.Prolem is that if i run my application and witout enter anything in user/password filds i click on register user link,it wont redirect me to register page.
if a enter a correct user in the fields and do login it goes to the secret page and now i come on login page and if now press the link register now it reirect me to register.aspx.
why it'snot running for the first time.?
pls rply...thanx
|
|
|
|
|
Hi all,
I have a gridview with a list of names. My code allows me to select and highlight all names and save to database. However I want to be able to de-select a particular row; say I select all 100 Records but I later decide I don't want to select/save a particular record and I want to select only 99 Records.
For this I've added a LinkButton Control into a Template Field of the Gridview. I want when this button is clicked to change the color (de-select) this particular row.
However I am not able to get a reference to the row which I want to cancel. I know if I let the user click the autogenerated select button I can get a reference to it using (grdView.SelectedIndex) but I don't want to do this. I want to be able to click the 'cancel' button, get a reference to the corresponding row and change its background color. Anyway to do this? Thanks
protected void grdViewCancelButton_Click(object sender, EventArgs e)
{
// Get Row you want to de-select
//int SelectedIndex = ?
// Change Row Background
//grdView.Rows[SelectedIndex].BackColor = System.Drawing.Color.Whatever;
}
modified on Tuesday, May 12, 2009 11:32 AM
|
|
|
|
|
What if you set the CommandName of your linkbutton to Select or Cancel??
Also, you can set the CommandArgument of the linkbutton to the index of the corresponding row (from code in the rowdatabound event), and on postbacks you can access this property from code to know the index of the row clicked
Alexei Rodriguez
|
|
|
|
|
Thanks,
This works
|
|
|
|
|
Glad it worked
Wich one of the 2 approaches did yo use??
Alexei Rodriguez
|
|
|
|