|
1) What will the value of txt be after executing MyFunction?
public void Main()
{
string txt = MyFunction( “12345” );
}
public string MyFunction( string str )
{
if( str.Length == 1 )
return str;
else
return MyFunction(str.Substring(1, str.Length - 1)) + str.Substring(0,1);
}
Hint:
String.Substring( startIndex, length )
Ans54321.
seema
|
|
|
|
|
1 - do your own homework, that's what it's for
2 - don't spam the boards
3 - certainly don't post in the ASP.NET forum, with a question that has nothing to do with ASP.NET.
Christian Graus - Microsoft MVP - C++
"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 )
|
|
|
|
|
I am trying to determine if this can be done or not. My company would like to try to use .Net to set up a pager application. A user would list all their information, group they are in, application(s) they support etc. When someone needs to page a person on call they would logon to this application, select the person to page and it would send out a page.
Currently it is written in ASP.Net front end, and MVS back end using Cobol/DB2.
We would like to try to have this all on the .Net platform.
2 things that we need to work
1 - Send out pages to 1 or more at a time
2 - Automatic pages
a - if one group gets paged, automatically page another group
b - automaticaly page at a certain date/time
Can all of this be accomplished?
If so can you please get me started on where to look, code examples etc.
Thanks,
Mark
|
|
|
|
|
Your first step should be contacting your wireless service provider. You'll need to check with them on how to send a page. They may have a web service, or a website you can write an http request to. They'll also let you know if you can find out if a page was responded to.
As for paging at a certain date and time. You can do that in .net code, but not via a web application. You'll need to code a windows service or use a sql server job or something. But that is still easy enough to do.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
I have a Gridview. I am adding new row to Gridview with a button click which is outside gridview. User can add as many rows and I need to update all the rows with one button click. The user add row to gridview and enter some information in the new row and again when he adds new row the previously entered information is erasing. How to persist the gridview rows data.
Thanks
|
|
|
|
|
What you can do is store a dataTable in viewstate.
You can write code to update the dataTable from grid or add new rows to the table and rebind. Then iterate through the gidview to save to database.
If you need a code example I might be able to track it down for you.
I didn't get any requirements for the signature
|
|
|
|
|
Hi,
Thanks for your answer. I am storing the Data Table in Viewstate and adding the new row to Datatable. But I am not updating the Datatable. How to update the datatable.If you can Please provide me the example.
Thanks in advance
|
|
|
|
|
Hi,
I have a gridview which contains the one ID column the user enters a new row to Gridview he enter some value to the ID column. On the ID TextChanged event I have to check whether this ID is exist in the database table or not. I am able to check the entered id against database table value. But here my question is if the entered id value not exist in the database then I am returing some 999 value. Then I have to provide validation error messages like “the Entered id doesnot exist” How to provide this validation.
Thanks
|
|
|
|
|
Hi All,
Can anybody let me know as to how can one access the parent page controls (textbox control value in my case) from within an iframe. I need to access the textbox control value on the parent page, for some logic impementation in my iframe code behind (.cs ). Can somebody answer me quick.
Thanks in Advance,
Rana78
-- modified at 10:56 Monday 13th August, 2007
s k bhuyan
|
|
|
|
|
Use "top" keyword for accessing parent page.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Michael ,can u please elaborate a little more(how do i use this keyword) more over i'am trying to access the parent page from server side code and not client end javascript !
Thanks,
Rana
-- modified at 12:04 Monday 13th August, 2007
Rana78
|
|
|
|
|
AFAIK, you can't access the control of parent page from Code-behind. So, you have to use Javascript for accessing the parent page. After that, you have to look a tick to access this client-side value from Code-behind..
For example: There are one textbox called Textbox1 and IFRAME in Default.aspx. There is another page called Default2.aspx which suppose to be shown in IFRAME of Default.aspx page. We add one button called Button1 in Default2.aspx (ChildPage). We wanna get the value of Textbox1 that is placed in Default.aspx (parent page) from Default2.aspx (childpage).
So, we have to write the following ocde in Form_load event of default2.aspx.
Button1.Attributes.Add ("onclick", "alert(top.document.getElementById('TextBox1').value);");
Yeah. I know that it's not exactly what you want. But the idea is that you have to get the value of controls of the parent page by using Javascript. Then, try to find the way to access the those values from Code-behind. (Using Server-side hidden field is one of the communication between client-side script and server-side script. )
Hope it helps.
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
You can do it with javascript.
For example:
add the following code on the child page
<br />
<script language="javascript"><br />
function Test()<br />
{<br />
var parentTextBox = parent.document.getElementById("TextBox1");<br />
<br />
alert(parentTextBox.value);<br />
}<br />
</script><br />
I am learning english
|
|
|
|
|
yeah. I agree with cheng.liu. Javascript is the only way you go.. Rana..
cheng.liu wrote: I am learning english
Oh. yeah. Me too..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
PS:
the Parent page and child page must under the same domain name.
//
cheng.liu wrote:
I am learning english
//
Oh. yeah. Me too..
//your english is very good.
/**-------------------------------------------**/
-- modified at 12:46 Monday 13th August, 2007
I am learning english.I am still having a few problem, but I getting better. I am very glad if you point my mistake in english.
TIA.
|
|
|
|
|
Thanks Everyone. I thought it was not possible, but was not sure so wanted the opinion of others. Thanks a lot again
Rana78
|
|
|
|
|
Hi,
I have a Gridview and one button ADD which will insert new row to Gridview and is outside of Gridview. Gridview contain one button DELETE column which is used to delete that row from gridview.
When the Delete button is clicked I want to delete that row For this I am doing like this: Where ID is the unique column in Gridview.
private DataRow FindRowByID(string id)
{
DataTable dt = (DataTable)Session["dt"];
DataRow[] rows = dt.Select("ID = " + id.ToString());
return rows[0];
}
Gridview_RowCommand()
{
if (e.CommandName == "RemovePartner")
{
string ind = e.CommandArgument.ToString();
FindRowByID.Delete(ind);
}
}
This is working fine when the inserted row ha ID value. If the user add a new row but did not enter any value into ID column and clicked on Delete then ID contain null value then how to delete that newly inserted row from Gridview.
Thanks
|
|
|
|
|
Mahimam wrote: ID contain null value then how to delete that newly inserted row from Gridview.
why not use Null Value as ID for deleting?
In our case, we don't allow the user to enter the ID. If the user enter new row then we generate the new ID (maybe the count of rows) for that new row. We use that id when we wanna delete the row..
Thanks and Regards,
Michael Sync ( Blog: http://michaelsync.net)
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message". Why vote? Plz Read it here. Thank you.
|
|
|
|
|
Hi,
I am currently building aproject management application. My current issue lies with a dynamic table which refreshes each time i choose a different project (from a dropdown). I used to create my controls (in the dynamic table) on PageLoad. This worked fine but however, the viewstate was retained when i chose another project eventhough i tried almost everything from EnableViewstate = false to many others...
So, the quick fix was to actually create the dynamic controls in the "selectedIndexChanged" event of the project dropDown. This worked great. However, i am having a problem to updated data in one of these dynamic textboxes. If i change a value in the dynamic texbox and then click on "Save" button, i lose the viewstate of this textbox and it reverts to its previous value. Moreover, i do have dynamics dropdowns in the same table and they work fine, passing the changes.
Can you please help me fix that out?
Thanks beforehand dear friends.
Krugger
|
|
|
|
|
whenever a control is added through controls.add() function, it goes through init,load and prerender. Add the dynamic textbox to the table or page before you set the property. this will enable the textbox to participate in the viewstate.
Dim txtBox As New TextBox
Table.Controls.Add(txtBox)
txtBox.Text = "ABCDE"
Regards
John
|
|
|
|
|
Hi all,
I have a gridview with select, that then loads my detailsview, the detailsview I use to create new entries, update existing and delete. All works but the gridview does not get refreshed.
The gridview uses a sqldatasource to get populated, and then the detailsview uses another sqldatasource to populate according to the gridview's selectedDataKey, the thing is that the second sqldatasource updates the database so the first sqldatasource does not reflect the changes, how do I get the first sqldatasource to reload, do I need to reload the entire page again or is there a better way of doing it?
Thanks in advance
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
Usually, if you do a post back the select method should get called again. You may have a caching issue. In my use of gridviews, I often cache the select results, so I don't have to call sql every time the user does a next or previous page click. The down side is you have to expire the cache when things get updated so the gridview will show the updated data. If you have not setup caching then there is some other problem.
Hope that helps.
Ben
|
|
|
|
|
After you make changes call DataBind() method of GridView1.
Example
GridView1.DataBind();
I Love SQL
|
|
|
|
|
Thanks, works like a dream
No matter how long he who laughs last laughs, he who laughs first has a head start!
|
|
|
|
|
You are welcome, it's my pleasure to help you.
I Love SQL
|
|
|
|