|
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
|
|
|
|
|
hello
anybody knows that how to set default orientation(Landscape) for Internet Explorer Browser.
My code
BODY {
Size: 8.5in 11in landscape;
}
is working fyn for Mozila Browser but its not working for IE browser.
any experts suggestion on this..
thanx
Dotnet
|
|
|
|
|
Hi Folks,
In my project i need to display the various menu's for different type of user also that we have using treeview for menu.the project developed in the VS 2003 and now we are migrating it to VS 2005 project. so we decided to use ASP .net Tree view control.
This is my code:
<asp:TreeView ID="TreeView1" runat="server" ImageSet="Arrows" Style="z-index: 102;
left: 24px; top: 32px; position: absolute;" Height="72px" Width="72px">
<ParentNodeStyle Font-Bold="False" />
<HoverNodeStyle Font-Underline="True" ForeColor="#5555DD"/>
<SelectedNodeStyle Font-Underline="True" ForeColor="#5555DD" HorizontalPadding="0px"
VerticalPadding="0px"/>
<Nodes>
<asp:TreeNode ShowCheckBox="False" Text="Reports" Value="Room Actions" Expanded="false"> </asp:TreeNode>
</Nodes>
</asp:TreeView>
It will throw an error:
inner Exception :
{"Using TreeView.HoverStyle requires Page.Header to be non-null (e.g. <head runat=\"server\" />)."}
outer Exception:
{"Error executing child request for Guest.aspx."}
This page is call by Server.Transfer method.
If you faced like this problem or if you have a solution for this please respond me.
ranandbe
|
|
|
|
|
Hi all..
I am having controls such as dropdown,button,textbox in my aspx page .I need to enable and disable them using javascript..Some one help with code in javascript..
Thanks & regards,
Balaguru
|
|
|
|
|
Bala,
Please post this to Javascript forums, to get better answers.
<form name="myForm"><br />
<input type="button" name="myButton" onClick="if (!this.disabled) someFunction()"><br />
<input type="submit" name="mySubmit" onClick="return (!this.disabled)"><br />
</form><br />
<br />
<script language="JavaScript"><!--<br />
document.myForm.myButton.disabled=true;<br />
document.myForm.mySubmit.disabled=true;<br />
|
|
|
|
|
hi,
Can anybody Pls. help me regarding FLvplayer, compatible with c#.net.
I'm working on a website that need to play user uloaded video files. I want to do this task using flvplayer. so can anybody provide me the link for the open source of flvplayer.
Or anything regarding the same.
It will be a great help for me.
Thanks,
Harryforums.
|
|
|
|
|
Hi,
I have a dropdown which shows products name(DataText) and product code(Datavalue).
Now i wanted to select first value and its value in textbox on page load?
|Muhamad Waqas Butt|
waqasb4all@yahoo.com
www.sktech.freewebspace.com
|
|
|
|
|
| Muhammad Waqas Butt | wrote: Now i wanted to select first value and its value in textbox on page load?
Do you want to select the value in dropdownlist that is entered in textbox ?
|
|
|
|