Click here to Skip to main content
15,896,606 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Object reference not set to an instance of an object [modified] Pin
kirthikirthi13-Aug-07 0:27
kirthikirthi13-Aug-07 0:27 
GeneralRe: Object reference not set to an instance of an object Pin
VanithaVasu13-Aug-07 1:59
VanithaVasu13-Aug-07 1:59 
QuestionRead Excel Using ASP.NET Pin
S A R I T H12-Aug-07 23:33
S A R I T H12-Aug-07 23:33 
AnswerRe: Read Excel Using ASP.NET Pin
Blue_Boy12-Aug-07 23:59
Blue_Boy12-Aug-07 23:59 
GeneralRe: Read Excel Using ASP.NET Pin
S A R I T H13-Aug-07 0:07
S A R I T H13-Aug-07 0:07 
GeneralRe: Read Excel Using ASP.NET Pin
Blue_Boy13-Aug-07 0:46
Blue_Boy13-Aug-07 0:46 
AnswerRe: Read Excel Using ASP.NET Pin
John-ph13-Aug-07 0:41
John-ph13-Aug-07 0:41 
QuestionSqlDataSource multiple fiters Pin
JacquesDP12-Aug-07 23:27
JacquesDP12-Aug-07 23:27 
Hi all,
I have a GridView that gets populated with a sqldatasource, then I have a detailsview that I use to update the values in the database, the gridview has autogenerateselect=true and when you select the row it should populate the details view, but I'm having trouble and the only reason that I can think of is because I have 2 columns as the primary key, because when I click on the select button on the gridview the detailsview just disapears. Can anyone please point me into the right direction as how I could fix this.

Here is the code that I use.

<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
DataKeyNames="menu_id,menu_language" AutoGenerateColumns="false" AutoGenerateSelectButton="true" AllowPaging="true">

<Columns>
<asp:BoundField ReadOnly="false" HeaderText="Id" DataField="menu_id" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Language" DataField="menu_language" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Text" DataField="menu_text" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="url" DataField="menu_url" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Avtive" DataField="menu_active" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Content Id" DataField="menu_content_id" NullDisplayText="N/A" />
</Columns>
</asp:GridView>

</div>
<div>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px"
DataSourceID="SqlDataSource2" AutoGenerateRows="false" DataKeyNames="menu_id,menu_language"
AutoGenerateDeleteButton="true" AutoGenerateEditButton="true" AutoGenerateInsertButton="true">
<Fields>
<asp:BoundField ReadOnly="false" HeaderText="Id" DataField="menu_id" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Language" DataField="menu_language" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Text" DataField="menu_text" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="url" DataField="menu_url" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Avtive" DataField="menu_active" NullDisplayText="N/A" />
<asp:BoundField ReadOnly="false" HeaderText="Content Id" DataField="menu_content_id" NullDisplayText="N/A" />
</Fields>
</asp:DetailsView>
</div>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
SelectCommand="Select * from [menu_items]"
ConnectionString="<%$ connectionStrings:localSqlServer %>">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
SelectCommand="Select * from [menu_items]"
FilterExpression="menu_id = '{0}' and menu_language='{1}'"
ConnectionString="<%$ connectionStrings:localSqlServer %>"
DataSourceMode="DataSet"
UpdateCommand="Update [menu_items] set [menu_text] = @menu_text, [menu_url] = @menu_url, [menu_active] = @menu_active,
[menu_content_id] = @menu_content_id where [menu_id] = @menu_id and [menu_language] = @menu_language"
InsertCommand="Insert into [menu_items] values(@menu_id, @menu_language, @menu_text, @menu_url, @menu_active, @menu_content_id)"
DeleteCommand="Delete from [menu_items] where [menu_id] = @menu_id and [menu_language] = @menu_language"
ConflictDetection="OverwriteChanges" EnableCaching="true"
CacheKeyDependency="MyKey" CacheDuration="Infinite">
<FilterParameters>
<asp:ControlParameter Name="menu_id" ControlID="GridView1" PropertyName="SelectedValue" />
<asp:ControlParameter Name="menu_language" ControlID="GridView1" PropertyName="SelectedValue" />
</FilterParameters>


Thanks in advance

No matter how long he who laughs last laughs, he who laughs first has a head start!

AnswerRe: SqlDataSource multiple fiters Pin
JacquesDP13-Aug-07 1:46
JacquesDP13-Aug-07 1:46 
QuestionSession end does not fire Pin
soneliso12-Aug-07 23:26
soneliso12-Aug-07 23:26 
AnswerRe: Session end does not fire Pin
N a r e s h P a t e l13-Aug-07 0:29
N a r e s h P a t e l13-Aug-07 0:29 
GeneralRe: Session end does not fire Pin
soneliso13-Aug-07 0:39
soneliso13-Aug-07 0:39 
GeneralRe: Session end does not fire Pin
N a r e s h P a t e l13-Aug-07 0:45
N a r e s h P a t e l13-Aug-07 0:45 
AnswerRe: Session end does not fire Pin
Michael Sync13-Aug-07 6:09
Michael Sync13-Aug-07 6:09 
QuestionPostBackUrl Pin
slSoftware12-Aug-07 23:25
slSoftware12-Aug-07 23:25 
AnswerRe: PostBackUrl Pin
N a r e s h P a t e l13-Aug-07 0:33
N a r e s h P a t e l13-Aug-07 0:33 
GeneralRe: PostBackUrl Pin
slSoftware13-Aug-07 1:11
slSoftware13-Aug-07 1:11 
QuestionNeed really Urgent Plz (Next and Previous Button in Media Player) Pin
Abubakarsb12-Aug-07 22:59
Abubakarsb12-Aug-07 22:59 
QuestionError when publishing Pin
samerh12-Aug-07 22:51
samerh12-Aug-07 22:51 
AnswerRe: Error when publishing Pin
N a r e s h P a t e l13-Aug-07 0:47
N a r e s h P a t e l13-Aug-07 0:47 
GeneralRe: Error when publishing Pin
samerh13-Aug-07 1:14
samerh13-Aug-07 1:14 
GeneralRe: Error when publishing Pin
N a r e s h P a t e l13-Aug-07 1:41
N a r e s h P a t e l13-Aug-07 1:41 
Questiondata grid with custom Paging Pin
sanjay_tutu12-Aug-07 22:27
sanjay_tutu12-Aug-07 22:27 
QuestionhttpModule VS Page_Load Pin
But_Im_a_Lady12-Aug-07 21:58
But_Im_a_Lady12-Aug-07 21:58 
AnswerRe: httpModule VS Page_Load Pin
N a v a n e e t h12-Aug-07 22:47
N a v a n e e t h12-Aug-07 22:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.