|
I have one query related to datagrid.
I have four textboxes for example textbox1,textbox2,textbox3,textbox4.
And a datagrid control displaying data from sql server 2000.It has four colums say column1,column2,column3,column4.
Now i want that when user click any row in that datagrid all the data of that particular row (say column1,column2,column3,column4) from a datagrid should appear in textbox1,textbox2,textbox3,textbox4.
Can any one can help me.I required to do this thing in my project.If possible can any one explain this wit any example.Or please give any link on the internet explaining this thing.
regards,
pranav
Pranav Dave
|
|
|
|
|
datagrid has a property called columns.. in that choose button column and choose edit,update and camcel... then go to the codebehind window and selet datagrid name in class name combo box and edit command in method name combo box.. then write this..
Private Sub dg_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dg.EditCommand
dg.EditItemIndex = e.Item.ItemIndex
Dim ds As DataSet = getdata()
bindgrid(ds)
End Sub
Public Function getdata() As DataSet
Try
con.Open()
ada = New OleDbDataAdapter("select * from topic", con)
ada.Fill(ds1)
Return ds1
Catch ex As Exception
Response.Write(ex.Message)
Finally
con.Close()
End Try
End Function
Public Function bindgrid(ByVal ds As DataSet)
dg.DataSource = ds
dg.DataBind()
End Function
this will automatically replace a texbox with the respective values
Nizha
|
|
|
|
|
similarly you have to write statements for update and cancel.. if you have any problem.. ask..
Nizha
|
|
|
|
|
iam having datagrid in a form once a clik on submit button
the values in a datagrid should be displayed in excel form
(c# asp.net)
help would be much apprecaited
vs 2003
|
|
|
|
|
Response.AddHeader("content-disposition","attachment;filename=Datagrid_TextBox.xls");
Response.ContentType = "application/vnd.ms-excel";
write these 2 lines in your button click event
Note: Datagrid_TextBox.xls--shuld be your .aspx page name where u have written datagrid code in
Mini
|
|
|
|
|
what happened to group i myself found the ans. whole
day i was searching for ans
it is not encoraging
with regards
rkr
|
|
|
|
|
I need information on what are the future proposed features in ASP.NET and the new areas that ASP.NET is venturing into. Please throw some light on this.
Thanks.
|
|
|
|
|
I want to display record one time only 20records but i don't know how to do?
................
|
|
|
|
|
Hi there,
+ Explain your question clearly. If you are asked like this, it is difficult to understand your exact problem.
Regards,
Jay
|
|
|
|
|
Probably you want to appky the paging concept. If so then you can use datagrid inbuilt paging to get the task done.
Best Regards,
Apurva Kaushal
|
|
|
|
|
i use asp not .net help me please
for emample: if havn't data series,model,sfx in database
series model sfx color
avan zze-deli A1 red
then insert new series,model,sfx and data already in database
series model sfx color
avan zze-deli A1 red
->avan zze-deli A1 white
then put character in englist desc z,y,x put back sfx
series model sfx color
avan zze-deli A1 red
->avan zze-deli A1Z white
avan zze-deli A1Y white,black
what should I do for code
Preaw
|
|
|
|
|
|
I have a report setup to generate in legal size. I export my report to PDF, and it looks fine on the screen.
When I go to print it, the default is always shown in letter in the printer dialog. I have to manually change the paper size in the dialog box to "Legal". Once I do this, everything works fine.
Is there a way to ensure that if I am attempting to print a legal size report that this dialog will default to legal?
Ye Htut
|
|
|
|
|
Hello Every body...
i have a doubt on
1.i created the login page with NAME and PASSWORD
2.in my database there are number of users all have login name and pasword
2.so next if i entered the login name and password in text boxes in
the webform1.aspx.then have to check in the database the given login name
password is available if available then shows message alert "the given
name and password already exist"
try to tell the codeing or clarify the doubt clearly with code...
please.....
Many Thanks
Dhulipudi
hai all please clarify mny doubts
|
|
|
|
|
What you need to do is to read the ADO.NET[^] tutorials to see how to connect to DB and execute a simple query with a simple where clause to check this thing.
|
|
|
|
|
Thank Q
hai all please clarify mny doubts
|
|
|
|
|
Hi. Regarding the relation between a Masterpage and some Content page I believe that sometimes it´s a bit difficult to decide where is the best place (Master or Content page) to put a Control. For example, I have a set of menu items (from a Menu control) that are displayed as Tabs. Suppose I have only 3 menu items that I call AAA,BBB,CCC ... when I click in AAA it should call the A.aspx page, the BBB > B.aspx and CCC > C.aspx ... The Menu control is in the masterpage named Master.master and A.aspx, B.aspx and C.aspx use this master page. I can think of 2 alternatives when building this Menu Items:
1st > I set the url attribute like AAA > url="~/A.aspx" and similar to the other menu items ... so when I click in any of these menu items I´ll be directed to the respective url
or
2nd > I don´t use the url attribute and catch the OnMenuItemClick event and then create code to switch to the proper url
Since I´m using Tabs, it would be nice to set the 'Active or Selected' Tab after the user clicks it. In the 2nd approach I can set the e.Item.Selected = true; but the Css used to mark the selected item will not work because after the click, the current page will be redirected to the proper page and the selected item will not be selected anymore. So I´ll have to end up creating complex code just to mark the selected item, probably in the current page (A,B or C.aspx) referencing the Menu control in the master page.
I believe there is a simple approach to this situation. What is the best way to set the selected/active tab? This is not hard when using plain html pages, but this master/content page relation are a bit confusing ... I already read this interesting article: http://www.dotnetslackers.com/XML/re-27950_Capture_Master_Page_Events_in_Content_Pages_ASP_NET_2_0.aspx, but I think there must have a simple approach to this situation which unfortunately I just don´t get.
|
|
|
|
|
Because you go from the current page to a new one when a menu item is clicked, so the ViewState of the selected item gets lost, and IMO you may only need to write code in the Master Page to set the selected item of the menu control. All three pages use the same Master Page, so you don't need to write code to set the selected menu item in each web page. Another option might be that you can use a single web page instead of 3, and because you don't go to the new page so the selected menu item is persisted.
|
|
|
|
|
Hi minhpc_bk,
You pointed 2 options:
1st: the one I´m using,eg navigating from current page to another, but with this option as you said, the ViewState of the selected item gets lost. What´s the solution for this option? Considering I want to navigate from one page to another ... Will I have to target the master page menu from each of the pages? That´s not a good solution ... too much coding
2nd: To use a single web page instead of 3, but this way I believe I´ll have to have views/panels hidden and showed according to the selected tab, right? This turn to concentrating too much logic in a single page. Suppose I have 100 tabs!!!
|
|
|
|
|
Sohdubom wrote: What´s the solution for this option? Considering I want to navigate from one page to another ... Will I have to target the master page menu from each of the pages? That´s not a good solution ... too much coding
Because you define the menu control in the Master Page and all the web pages use this Master Page, so I think you only need to write code to set the selected menu item in the master page only and no need to do that from each content page. For example, you have 3 web pages A.aspx, B.aspx, C.aspx and the menu control in the master page is defined with 3 items accordingly. At run time you can detect the url of the current requested page by checking the Request object or SiteMap (if you define web.sitemap file), you then can set the Selected propety of the right menu item. The sample code to select the menu item in the master page looks something like:
string url = Request.Url.AbsoluteUri;
if (url.Contains("A.aspx"))
Menu1.Items[0].Selected = true;
else if(url.Contains("B.aspx"))
Menu1.Items[1].Selected = true;
else
Menu1.Items[2].Selected = true;
Sohdubom wrote: To use a single web page instead of 3, but this way I believe I´ll have to have views/panels hidden and showed according to the selected tab, right? This turn to concentrating too much logic in a single page. Suppose I have 100 tabs!!!
You're right, this option should only be used when you have just a few web pages.
|
|
|
|
|
In my masterpage code behind, where should I put the code above? I´m asking it because, when creating a menu I have basically 2 options: if I set prior the url for each menu item then I will not be able to use the OnMenuItemClick event, if I want to use that event I must secify menu items without the url and with the selectable attribute set to true. My menu is built using a custom sitemap provider and it renders like:
If the intention is to use OnMenuItemClick then the render code will be:
Using the option above I can make the selectable link like:
|
|
|
|
|
The sample code is used to set the Selected property of an item in the Menu Items collection, and this collection is built based on data bound to it, so you can use this code when data is bound to the menu control or after that. And one of events that you can put the sample code in is the MenuItemDataBound which is fired after a MenuItem is databound and you can check this item is selected or not. The sample code looks something like.
protected void Menu2_MenuItemDataBound(object sender, MenuEventArgs e)
{
string url = Request.Url.AbsoluteUri;
e.Item.Selected = url.Contains(e.Item.Text);
}
You mean you use the AspNet-Menu-Link AspNet-Menu-Selected stylesheet class to set the selected menu item? If so, once you can keep the selected item as it is with code, the style class will be applied.
|
|
|
|
|
Hi minhpc_bk,
That solved the issue in a simple way. I just changed the comparison to:
e.Item.Selected = url.Contains( e.Item.NavigateUrl.Remove( 0, 1 ) );
Because this way I don´t have to set the name of the page (navigate url) based on its title attribute, eg: url = "~/microsoft.com" and title="... Microsoft"
I can do something like: url = "~/a.com" and title="... Microsoft"
Then the string url = Request.Url.AbsoluteUri; > http://.../a.com will be compared to: e.Item.NavigateUrl.Remove( 0, 1 ) > "/a.com"
But either way, you gladly solved the problem!!!
Thanks for the patience
|
|
|
|
|
hi friends
i stored 10 image in database like this (for ex images\logos\country\INN9.gif )
now i want to retrieve the image and display in asp image control
here one condition i have 10 buttons for 10 image i click corresponding button that image will be displayed in asp:image control
can anyone tell me
thanks in advance
regards
saravanan
|
|
|
|
|
Here are the basic steps that you may need to do:
+ Create an event handler for 10 buttons' Click event.
+ In the handler, use the ADO.NET[^] to connect to the database to query the image url.
+ Set the image url to the Image.ImageUrl Property [^]
|
|
|
|